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 of
SynchronizableContentsCollection
.-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentWorkflowHelper
The content workflow helperprotected CurrentUserProvider
The current user providerprotected boolean
True if there is a global error during synchronizationprotected I18nUtils
The i18n utilsprotected int
Number of created contentsprotected int
Number of deleted contentsprotected int
Number of errors encounteredprotected int
Number of unchanged contentsprotected int
Number of synchronized contentsprotected ObservationManager
The observation managerprotected static final String
SCC unique ID fieldFields inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_contentDAO, _contentPrefix, _contentType, _contentTypeEP, _id, _ignoreRestrictions, _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, LAST_SYNCHRONIZATION_DATA_NAME, LAST_SYNCHRONIZATION_USER_DATA_NAME, RESULT_NB_CREATED_CONTENTS, RESULT_NB_DELETED_CONTENTS, RESULT_NB_NOT_CHANGED_CONTENTS, RESULT_NB_SYNCHRONIZED_CONTENTS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
_deleteContents
(List<Content> contentsToRemove, Logger logger) Delete contents.Retrieves additional inputs for content creationprotected String
_getContentPathQuery
(String lang, String idValue, String contentType) Construct the query to retrieve the content.Filter the contents to remove.protected List<Expression>
_getExpressionsList
(String lang, String idValue, String contentType) Construct the query to retrieve the content.protected boolean
Checks if some content have changed during the synchronizationprotected List<ModifiableContent>
_internalPopulate
(Logger logger) Internal implementation ofpopulate(Logger, ContainerProgressionTracker)
protected abstract List<ModifiableContent>
_internalPopulate
(Logger logger, ContainerProgressionTracker progressionTracker) Internal implementation ofpopulate(Logger, ContainerProgressionTracker)
protected boolean
_isParamNotEmpty
(Object parameterValue) Check if the parameter value is emptyprotected void
_logSynchronizationResult
(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_removeEmptyParameters
(Map<String, Object> searchParameters) Remove empty parameters to the mapprotected ModifiableContent
createContentAction
(String contentType, String workflowName, int initialActionId, String lang, String contentTitle, Logger logger) Creates content action with result from requestprotected void
deleteUnexistingContents
(Logger logger) Delete contents created by a previous synchronization which does not exist anymore in remote sourcevoid
Empty the collection of its synchronized contentsRetrieves 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 contentspopulate
(Logger logger, ContainerProgressionTracker progressionTracker) Populates contentsprotected void
sendErrorMail
(int nbError) Sends the report mailsvoid
service
(ServiceManager manager) protected void
validateContent
(WorkflowAwareContent content, int validationActionId, Logger logger) Validates a content after importMethods 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, ignoreRestrictions, 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 Details
-
SCC_UNIQUE_ID
SCC unique ID field- See Also:
-
_i18nUtils
The i18n utils -
_currentUserProvider
The current user provider -
_observationManager
The observation manager -
_contentWorkflowHelper
The content workflow helper -
_nbError
Number of errors encountered -
_hasGlobalError
True if there is a global error during synchronization -
_nbCreatedContents
Number of created contents -
_nbSynchronizedContents
Number of synchronized contents -
_nbNotChangedContents
Number of unchanged contents -
_nbDeletedContents
Number of deleted contents
-
-
Constructor Details
-
AbstractSynchronizableContentsCollection
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractStaticSynchronizableContentsCollection
- Throws:
ServiceException
-
populate
public List<ModifiableContent> populate(Logger logger, ContainerProgressionTracker progressionTracker) Description copied from interface:SynchronizableContentsCollection
Populates contents- Parameters:
logger
- The loggerprogressionTracker
- A progression tracker- Returns:
- Return the populated contents (imported or synchronized)
-
_internalPopulate
Internal implementation ofpopulate(Logger, ContainerProgressionTracker)
- Parameters:
logger
- The logger- Returns:
- The list of created/synchronized contents
-
_internalPopulate
protected abstract List<ModifiableContent> _internalPopulate(Logger logger, ContainerProgressionTracker progressionTracker) Internal implementation ofpopulate(Logger, ContainerProgressionTracker)
- Parameters:
logger
- The loggerprogressionTracker
- The progression tracker- Returns:
- The list of created/synchronized contents
-
empty
Description copied from interface:SynchronizableContentsCollection
Empty the collection of its synchronized contents- Parameters:
logger
- The logger
-
deleteUnexistingContents
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
Delete contents.- Parameters:
contentsToRemove
- List of contents to removelogger
- The logger- Returns:
- the number of deleted contents
-
_logSynchronizationResult
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
Checks if some content have changed during the synchronization- Returns:
true
if some contents have changed,false
otherwise
-
sendErrorMail
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
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, 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
Retrieves additional inputs for content creation- Returns:
- the additional inputs for content creation
-
_getExpressionsList
Construct the query to retrieve the content.- Parameters:
lang
- LangidValue
- Synchronization valuecontentType
- Content type- Returns:
- The
List
ofExpression
-
_getContentPathQuery
Construct the query to retrieve the content.- Parameters:
lang
- LangidValue
- Synchronization valuecontentType
- Content type- Returns:
- The XPATH query
-
_removeEmptyParameters
Remove empty parameters to the map- Parameters:
searchParameters
- the parameters- Returns:
- the map of none empty parameters
-
_isParamNotEmpty
Check if the parameter value is empty- Parameters:
parameterValue
- the parameter value- Returns:
- true if the parameter value is empty
-
getSynchronizationResult
Description copied from interface:SynchronizableContentsCollection
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 contents
- Returns:
- the result of the synchronization
-