Package org.ametys.plugins.odfsync.cdmfr
Class CDMFrSynchronizableContentsCollection
java.lang.Object
org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
org.ametys.plugins.odfsync.cdmfr.AbstractCDMFrSynchronizableContentsCollection
org.ametys.plugins.odfsync.cdmfr.CDMFrSynchronizableContentsCollection
- All Implemented Interfaces:
SynchronizableContentsCollection
,Configurable
,Contextualizable
,Serviceable
public class CDMFrSynchronizableContentsCollection
extends AbstractCDMFrSynchronizableContentsCollection
implements Contextualizable
Class for CDMFr import and synchronization
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
Data source parameter : folderprotected File
CDM-fr folderprotected Context
The Cocoon contextprotected String
Default language configured for ODFList of synchronized contents (to avoid a treatment twice or more)Fields inherited from class org.ametys.plugins.odfsync.cdmfr.AbstractCDMFrSynchronizableContentsCollection
_importCDMFrComponent
Fields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_contentTypeEP, _currentUserProvider, _hasGlobalError, _i18nUtils, _nbCreatedContents, _nbDeletedContents, _nbError, _nbNotChangedContents, _nbSynchronizedContents, _observationManager, _synchroComponent, SCC_UNIQUE_ID
Fields inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_contentDAO, _contentPrefix, _contentType, _id, _initialActionId, _label, _languages, _modelId, _modelParamValues, _removalSync, _reportMails, _resolver, _restrictedField, _sccHelper, _searchModelConfiguration, _synchronizeActionId, _synchronizeExistingContentsOnly, _synchronizingContentOperator, _validateActionId, _validateAfterImport, _workflowName
Fields inherited from interface org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollection
COLLECTION_ID_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionFilter the contents to remove.Handle the CDM-fr file to import all the programs and its dependencies containing into it.protected List<ModifiableDefaultContent>
_internalPopulate
(Logger logger) Internal implementation ofAbstractSynchronizableContentsCollection.populate(Logger)
void
configure
(Configuration configuration) protected void
configureDataSource
(Configuration configuration) Configure the data source parameters.protected void
Configure the search model used by SCCSearchTool.protected void
Configure the specific parameters of this implementation of CDM-fr import.void
contextualize
(Context context) getContent
(String lang, String idValue) Gets the content in the repositoryint
getTotalCount
(Map<String, Object> parameters, Logger logger) Return the total number of results for the search.boolean
Return true if aRightAssignmentContext
should be automatically generated for the contents of this SCCImport a content from remote values.protected File[]
internalSearch
(Map<String, Object> parameters, Logger logger) Search values and return the result without any treatment.Search the data to import from parameters.void
synchronizeContent
(ModifiableDefaultContent content, Logger logger) Synchronize a content with remove values.void
updateSyncInformations
(ModifiableDefaultContent content, String syncCode, Logger logger) Method to update the synchronisation informations (collection and value of the ID field).Methods inherited from class org.ametys.plugins.odfsync.cdmfr.AbstractCDMFrSynchronizableContentsCollection
getExternalOnlyFields, getIdField, getLocalAndExternalFields, service
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_deleteContents, _getContentPathQuery, _getExpressionsList, _getMetadataHolder, _isParamNotEmpty, _removeEmptyParameters, _removeMetadataIfExists, _synchronizeMetadata, _updateRelation, _updateRelation, applyChanges, applyChanges, createContentAction, deleteUnexistingContents, empty, populate, sendErrorMail, updateSCCProperty, validateContent
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_parseLanguages, _parseParameters, configureStaticParams, getContentPrefix, getContentType, getId, getInitialActionId, getLabel, getLanguages, getParameterValues, getReportMails, getRestrictedField, getSearchModelConfiguration, getSynchronizeActionId, getSynchronizeCollectionModelId, getSynchronizingContentOperator, getValidateActionId, getWorkflowName, removalSync, synchronizeExistingContentsOnly, validateAfterImport
-
Field Details
-
__PARAM_FOLDER
Data source parameter : folder- See Also:
-
_cocoonContext
The Cocoon context -
_cdmfrFolder
CDM-fr folder -
_odfLang
Default language configured for ODF -
_updatedContents
List of synchronized contents (to avoid a treatment twice or more)
-
-
Constructor Details
-
CDMFrSynchronizableContentsCollection
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
configure
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractStaticSynchronizableContentsCollection
- Throws:
ConfigurationException
-
_internalPopulate
Description copied from class:AbstractSynchronizableContentsCollection
Internal implementation ofAbstractSynchronizableContentsCollection.populate(Logger)
- Overrides:
_internalPopulate
in classAbstractCDMFrSynchronizableContentsCollection
- Parameters:
logger
- The logger- Returns:
- The list of created/synchronized contents
-
importContent
public List<ModifiableDefaultContent> importContent(String idValue, Map<String, Object> additionalParameters, Logger logger) throws ExceptionDescription copied from interface:SynchronizableContentsCollection
Import a content from remote values.- Specified by:
importContent
in interfaceSynchronizableContentsCollection
- Parameters:
idValue
- Id (for import/synchronization) of the content to importadditionalParameters
- Additional parameterslogger
- The logger- Returns:
- A list of created contents
- Throws:
Exception
- if an error occurs.
-
_handleFile
protected Map<String,Object> _handleFile(File cdmfrFile, Map<String, Object> parameters, Logger logger) Handle the CDM-fr file to import all the programs and its dependencies containing into it.- Parameters:
cdmfrFile
- The CDM-fr fileparameters
- Parameters used to import the filelogger
- The logger- Returns:
- The list of imported/synchronized programs
-
search
public Map<String,Map<String, searchObject>> (Map<String, Object> parameters, int offset, int limit, List<Object> sort, Logger logger) Description copied from interface:SynchronizableContentsCollection
Search the data to import from parameters.- Specified by:
search
in interfaceSynchronizableContentsCollection
- Overrides:
search
in classAbstractCDMFrSynchronizableContentsCollection
- Parameters:
parameters
- Parameters for the searchoffset
- Begin of the searchlimit
- Number of resultssort
- Sort of results (ignored for LDAP results)logger
- The logger- Returns:
- A map of remote values by content
-
getTotalCount
Description copied from interface:SynchronizableContentsCollection
Return the total number of results for the search.- Specified by:
getTotalCount
in interfaceSynchronizableContentsCollection
- Overrides:
getTotalCount
in classAbstractCDMFrSynchronizableContentsCollection
- Parameters:
parameters
- Parameters for the searchlogger
- The logger- Returns:
- The total count
-
internalSearch
Search values and return the result without any treatment.- Parameters:
parameters
- Search parameters to restrict the searchlogger
- The logger- Returns:
File
tab listing the available CDM-fr files corresponding to the filter.
-
configureDataSource
Description copied from class:AbstractStaticSynchronizableContentsCollection
Configure the data source parameters.- Overrides:
configureDataSource
in classAbstractCDMFrSynchronizableContentsCollection
- Parameters:
configuration
- Configuration to read- Throws:
ConfigurationException
- If an error occurs
-
configureSpecificParameters
Configure the specific parameters of this implementation of CDM-fr import. -
configureSearchModel
Description copied from class:AbstractStaticSynchronizableContentsCollection
Configure the search model used by SCCSearchTool.- Overrides:
configureSearchModel
in classAbstractCDMFrSynchronizableContentsCollection
-
updateSyncInformations
public void updateSyncInformations(ModifiableDefaultContent content, String syncCode, Logger logger) throws Exception Description copied from interface:SynchronizableContentsCollection
Method to update the synchronisation informations (collection and value of the ID field).- Specified by:
updateSyncInformations
in interfaceSynchronizableContentsCollection
- Overrides:
updateSyncInformations
in classAbstractCDMFrSynchronizableContentsCollection
- Parameters:
content
- Content to updatesyncCode
- New synchronization codelogger
- The logger- Throws:
Exception
- if an error occurs.
-
synchronizeContent
Description copied from interface:SynchronizableContentsCollection
Synchronize a content with remove values.- Specified by:
synchronizeContent
in interfaceSynchronizableContentsCollection
- Overrides:
synchronizeContent
in classAbstractCDMFrSynchronizableContentsCollection
- Parameters:
content
- The content to synchronizelogger
- The logger- Throws:
Exception
- if an error occurs.
-
getContent
Description copied from interface:SynchronizableContentsCollection
Gets the content in the repository- Specified by:
getContent
in interfaceSynchronizableContentsCollection
- Overrides:
getContent
in classAbstractCDMFrSynchronizableContentsCollection
- Parameters:
lang
- the languageidValue
- the content name- Returns:
- the content in the repository, or null if does not exist
-
handleRightAssignmentContext
Description copied from interface:SynchronizableContentsCollection
Return true if aRightAssignmentContext
should be automatically generated for the contents of this SCC- Specified by:
handleRightAssignmentContext
in interfaceSynchronizableContentsCollection
- Returns:
- true to automatically generate a
RightAssignmentContext
. Return false if the rights of contents of this SCC are handle by its ownRightAssignmentContext
-
_getContentsToRemove
protected List<Content> _getContentsToRemove(AmetysObjectIterable<ModifiableDefaultContent> contents) Description copied from class:AbstractSynchronizableContentsCollection
Filter the contents to remove.- Overrides:
_getContentsToRemove
in classAbstractCDMFrSynchronizableContentsCollection
- Parameters:
contents
- The list of all the available contents- Returns:
- The
List
ofContent
to remove.
-