Class AbstractDefaultSynchronizableContentsCollection

All Implemented Interfaces:
SynchronizableContentsCollection, Configurable, Serviceable

Abstract for default and simplified implementation of SCC.

Mandatory methods are:

It may be useful to override the following methods too:

  • getLocalAndExternalFields(Map) to set the values from synchronization into remote values. These attributes name will have the synchronization toggle on edition.
  • _getMapping(Map) to modify the default mapping, default mapping consider the field name from results as the final attribute name. The mapping can receive data from several fields.

You have to declare your now SCC model into a plugin.xml through the following extension:

  <extension id="fr.ametys.myproject.scc.static"
               class="org.ametys.plugins.contentio.synchronize.impl.DefaultSynchronizableContentsCollectionModel"
               point="org.ametys.plugins.contentio.synchronize.SynchronizeContentsCollectionModelExtensionPoint">
      <class name="org.ametys.plugins.contentio.synchronize.impl.StaticSynchronizableContentsCollection"/>
          <label i18n="false">Static SCC</label>
          <description i18n="false">Static SCC</description>
  </extension>
 

And it's also possible to declare a synchronization button on the content:

  <extension id="fr.ametys.myproject.scc.static.SynchronizePerson"
                point="org.ametys.core.ui.RibbonControlsManager"
                class="org.ametys.plugins.contentio.synchronize.clientsideelement.SCCSmartContentClientSideElement">
      <class name="Ametys.plugins.cms.content.controller.SmartContentController">
          <action>Ametys.plugins.contentio.search.SynchronizeContentAction.act</action>
 
          <sccModelId>fr.ametys.myproject.scc.static</sccModelId>
 
          <label type="false">Synchroniser le contenu</label>
          <description type="false">Synchronisation du contenu</description>
 
          <field-label>Login</field-label>
 
          <selection-target-id>^content$</selection-target-id>
          <selection-target-parameter>
              <name>^types$</name>
              <value>^org.ametys.plugins.odf.Content.person$</value>
          </selection-target-parameter>
          <selection-enable-multiselection>false</selection-enable-multiselection>
 
          <icon-glyph>ametysicon-arrow123</icon-glyph>
 
          <selection-description-empty type="i18n">plugin.contentio:PLUGINS_CONTENTIO_BUTTON_SYNCHRONIZE_NOCONTENT</selection-description-empty>
          <selection-description-nomatch type="i18n">plugin.contentio:PLUGINS_CONTENTIO_BUTTON_SYNCHRONIZE_NOCONTENT</selection-description-nomatch>
          <selection-description-multiselectionforbidden type="i18n">plugin.cms:CONTENT_EDIT_DESCRIPTION_MANYCONTENT</selection-description-multiselectionforbidden>
 
          <allright-start-description type="i18n">plugin.contentio:PLUGINS_CONTENTIO_BUTTON_SYNCHRONIZE_START</allright-start-description>
          <allright-end-description type="i18n">plugin.contentio:PLUGINS_CONTENTIO_BUTTON_SYNCHRONIZE_CONTENT_END</allright-end-description>
          <allright-content-description type="i18n">plugin.contentio:PLUGINS_CONTENTIO_BUTTON_SYNCHRONIZE_CONTENT</allright-content-description>
          <error-description type="i18n">plugin.cms:CONTENT_EDIT_DESCRIPTION_ERROR</error-description>
 
          <enabled-on-unlock-only>true</enabled-on-unlock-only>
          <locked-start-description type="i18n">plugin.cms:CONTENT_EDIT_DESCRIPTION_LOCKED_START</locked-start-description>
          <locked-end-description type="i18n">plugin.cms:CONTENT_EDIT_DESCRIPTION_LOCKED_END</locked-end-description>
          <locked-content-description type="i18n">plugin.cms:CONTENT_EDIT_DESCRIPTION_LOCKED_CONTENT</locked-content-description>
      </class>
      <scripts>
          <file plugin="cms">js/Ametys/plugins/cms/content/controller/SmartContentController.js</file>
          <file plugin="contentio">js/Ametys/plugins/contentio/search/SynchronizeContentAction.js</file>
      </scripts>
      <depends>
          <org.ametys.core.ui.UIToolsFactoriesManager>uitool-server-logs</org.ametys.core.ui.UIToolsFactoriesManager>
      </depends>
  </extension>
 

And a tool to search and import a single content:

  <extension id="fr.ametys.myproject.scc.static.Import"
                point="org.ametys.core.ui.RibbonControlsManager"
                class="org.ametys.plugins.contentio.synchronize.clientsideelement.SCCClientSideElement">
      <class name="Ametys.ribbon.element.ui.button.OpenToolButtonController">
          <opentool-id>uitool-scc-import</opentool-id>
 
          <sccModelId>fr.ametys.myproject.scc.static</sccModelId>
 
          <label type="false">Importer un contenu</label>
          <description type="false">Import d'un contenu</description>
 
          <icon-glyph>ametysicon-body-people</icon-glyph>
          <icon-decorator>decorator-ametysicon-upload119</icon-decorator>
          <icon-decorator-type>action-create</icon-decorator-type>
      </class>
      <depends>
          <org.ametys.core.ui.UIToolsFactoriesManager>uitool-scc-import</org.ametys.core.ui.UIToolsFactoriesManager>
      </depends>
  </extension>