Class AbstractSynchronizableContentsCollection
- java.lang.Object
-
- org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
-
- org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
-
- All Implemented Interfaces:
SynchronizableContentsCollection,Configurable,Serviceable
- Direct Known Subclasses:
AbstractCDMFrSynchronizableContentsCollection,AbstractSimpleSynchronizableContentsCollection
public abstract class AbstractSynchronizableContentsCollection extends AbstractStaticSynchronizableContentsCollection
Abstract implementation ofSynchronizableContentsCollection.
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentWorkflowHelper_contentWorkflowHelperThe content workflow helperprotected CurrentUserProvider_currentUserProviderThe current user providerprotected boolean_hasGlobalErrorTrue if there is a global error during synchronizationprotected I18nUtils_i18nUtilsThe i18n utilsprotected int_nbCreatedContentsNumber of created contentsprotected int_nbDeletedContentsNumber of deleted contentsprotected int_nbErrorNumber of errors encounteredprotected int_nbNotChangedContentsNumber of unchanged contentsprotected int_nbSynchronizedContentsNumber of synchronized contentsprotected ObservationManager_observationManagerThe observation managerprotected static StringSCC_UNIQUE_IDSCC unique ID field-
Fields inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_contentDAO, _contentPrefix, _contentType, _contentTypeEP, _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_DATA_NAME, RESULT_NB_CREATED_CONTENTS, RESULT_NB_DELETED_CONTENTS, RESULT_NB_NOT_CHANGED_CONTENTS, RESULT_NB_SYNCHRONIZED_CONTENTS
-
-
Constructor Summary
Constructors Constructor Description AbstractSynchronizableContentsCollection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected int_deleteContents(List<Content> contentsToRemove, org.slf4j.Logger logger)Delete contents.protected Map<String,Object>_getAdditionalInputsForContentCreation()Retrieves additional inputs for content creationprotected String_getContentPathQuery(String lang, String idValue, String contentType)Construct the query to retrieve the content.protected abstract List<Content>_getContentsToRemove(AmetysObjectIterable<ModifiableContent> contents)Filter the contents to remove.protected List<Expression>_getExpressionsList(String lang, String idValue, String contentType)Construct the query to retrieve the content.protected boolean_hasSomethingChanged()Checks if some content have changed during the synchronizationprotected abstract List<ModifiableContent>_internalPopulate(org.slf4j.Logger logger)Internal implementation ofpopulate(Logger)protected boolean_isParamNotEmpty(Object parameterValue)Check if the parameter value is emptyprotected void_logSynchronizationResult(org.slf4j.Logger logger)Logs the result of the synchronization, containing The number of created contents The number of synchronized contents The number of unchanged contents The number of deleted contentsprotected Map<String,Object>_removeEmptyParameters(Map<String,Object> searchParameters)Remove empty parameters to the mapprotected ModifiableContentcreateContentAction(String contentType, String workflowName, int initialActionId, String lang, String contentTitle, org.slf4j.Logger logger)Creates content action with result from requestprotected voiddeleteUnexistingContents(org.slf4j.Logger logger)Delete contents created by a previous synchronization which does not exist anymore in remote sourcevoidempty(org.slf4j.Logger logger)Empty the collection of its synchronized contentsMap<String,Integer>getSynchronizationResult()Retrieves the result of the synchronization as a map of key / content count containing The number of created contents The number of synchronized contents The number of unchanged contents The number of deleted contentsList<ModifiableContent>populate(org.slf4j.Logger logger)Populates contentsprotected voidsendErrorMail(int nbError)Sends the report mailsvoidservice(ServiceManager manager)protected voidvalidateContent(WorkflowAwareContent content, int validationActionId, org.slf4j.Logger logger)Validates a content after import-
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_parseLanguages, _parseParameters, _transformRemoteValuesCardinality, configure, configureDataSource, configureSearchModel, configureStaticParams, getContentPrefix, getContentType, getId, getInitialActionId, getLabel, getLanguages, getParameterValues, getReportMails, getRestrictedField, getSearchModelConfiguration, getSynchronizeActionId, getSynchronizeCollectionModelId, getSynchronizingContentOperator, getValidateActionId, getWorkflowName, removalSync, synchronizeExistingContentsOnly, validateAfterImport
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollection
additionalCommonOperations, additionalImportOperations, additionalSynchronizeOperations, getContent, getIdField, getLocalAndExternalFields, getTotalCount, handleRightAssignmentContext, importContent, search, synchronizeContent, updateSyncInformations
-
-
-
-
Field Detail
-
SCC_UNIQUE_ID
protected static final String SCC_UNIQUE_ID
SCC unique ID field- See Also:
- Constant Field Values
-
_i18nUtils
protected I18nUtils _i18nUtils
The i18n utils
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_observationManager
protected ObservationManager _observationManager
The observation manager
-
_contentWorkflowHelper
protected ContentWorkflowHelper _contentWorkflowHelper
The content workflow helper
-
_nbError
protected int _nbError
Number of errors encountered
-
_hasGlobalError
protected boolean _hasGlobalError
True if there is a global error during synchronization
-
_nbCreatedContents
protected int _nbCreatedContents
Number of created contents
-
_nbSynchronizedContents
protected int _nbSynchronizedContents
Number of synchronized contents
-
_nbNotChangedContents
protected int _nbNotChangedContents
Number of unchanged contents
-
_nbDeletedContents
protected int _nbDeletedContents
Number of deleted contents
-
-
Constructor Detail
-
AbstractSynchronizableContentsCollection
public AbstractSynchronizableContentsCollection()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractStaticSynchronizableContentsCollection- Throws:
ServiceException
-
populate
public List<ModifiableContent> populate(org.slf4j.Logger logger)
Description copied from interface:SynchronizableContentsCollectionPopulates contents- Parameters:
logger- The logger- Returns:
- Return the populated contents (imported or synchronized)
-
_internalPopulate
protected abstract List<ModifiableContent> _internalPopulate(org.slf4j.Logger logger)
Internal implementation ofpopulate(Logger)- Parameters:
logger- The logger- Returns:
- The list of created/synchronized contents
-
empty
public void empty(org.slf4j.Logger logger)
Description copied from interface:SynchronizableContentsCollectionEmpty the collection of its synchronized contents- Parameters:
logger- The logger
-
deleteUnexistingContents
protected void deleteUnexistingContents(org.slf4j.Logger logger)
Delete contents created by a previous synchronization which does not exist anymore in remote source- Parameters:
logger- The logger
-
_getContentsToRemove
protected abstract List<Content> _getContentsToRemove(AmetysObjectIterable<ModifiableContent> contents)
Filter the contents to remove.
-
_deleteContents
protected int _deleteContents(List<Content> contentsToRemove, org.slf4j.Logger logger)
Delete contents.- Parameters:
contentsToRemove- List of contents to removelogger- The logger- Returns:
- the number of deleted contents
-
_logSynchronizationResult
protected void _logSynchronizationResult(org.slf4j.Logger logger)
Logs the result of the synchronization, containing- The number of created contents
- The number of synchronized contents
- The number of unchanged contents
- The number of deleted contents
- Parameters:
logger- the logger
-
_hasSomethingChanged
protected boolean _hasSomethingChanged()
Checks if some content have changed during the synchronization- Returns:
trueif some contents have changed,falseotherwise
-
sendErrorMail
protected void sendErrorMail(int nbError) throws jakarta.mail.MessagingException, IOException
Sends the report mails- Parameters:
nbError- The number of error- Throws:
jakarta.mail.MessagingException- if a messaging error occurredIOException- if an error occurred building the message
-
validateContent
protected void validateContent(WorkflowAwareContent content, int validationActionId, org.slf4j.Logger logger)
Validates a content after import- Parameters:
content- The content to validatevalidationActionId- Validation action ID to use for this contentlogger- The logger
-
createContentAction
protected ModifiableContent createContentAction(String contentType, String workflowName, int initialActionId, String lang, String contentTitle, org.slf4j.Logger logger)
Creates content action with result from request- Parameters:
contentType- Type of the content to createworkflowName- Workflow to use for this contentinitialActionId- Action ID for initializationlang- The languagecontentTitle- The content titlelogger- The logger- Returns:
- The content id, or null of a workflow error occured
-
_getAdditionalInputsForContentCreation
protected Map<String,Object> _getAdditionalInputsForContentCreation()
Retrieves additional inputs for content creation- Returns:
- the additional inputs for content creation
-
_getExpressionsList
protected List<Expression> _getExpressionsList(String lang, String idValue, String contentType)
Construct the query to retrieve the content.- Parameters:
lang- LangidValue- Synchronization valuecontentType- Content type- Returns:
- The
ListofExpression
-
_getContentPathQuery
protected String _getContentPathQuery(String lang, String idValue, String contentType)
Construct the query to retrieve the content.- Parameters:
lang- LangidValue- Synchronization valuecontentType- Content type- Returns:
- The XPATH query
-
_removeEmptyParameters
protected Map<String,Object> _removeEmptyParameters(Map<String,Object> searchParameters)
Remove empty parameters to the map- Parameters:
searchParameters- the parameters- Returns:
- the map of none empty parameters
-
_isParamNotEmpty
protected boolean _isParamNotEmpty(Object parameterValue)
Check if the parameter value is empty- Parameters:
parameterValue- the parameter value- Returns:
- true if the parameter value is empty
-
getSynchronizationResult
public Map<String,Integer> getSynchronizationResult()
Description copied from interface:SynchronizableContentsCollectionRetrieves the result of the synchronization as a map of key / content count containing- The number of created contents
- The number of synchronized contents
- The number of unchanged contents
- The number of deleted contents
- Returns:
- the result of the synchronization
-
-