public abstract class AbstractSynchronizableContentsCollection extends AbstractStaticSynchronizableContentsCollection implements Serviceable
SynchronizableContentsCollection
.Modifier and Type | Field and Description |
---|---|
protected ContentDAO |
_contentDAO
The content DAO
|
protected ContentTypeExtensionPoint |
_contentTypeEP
The content type extension point
|
protected CurrentUserProvider |
_currentUserProvider
The current user provider
|
protected boolean |
_hasGlobalError
True if there is a global error during synchronization
|
protected I18nUtils |
_i18nUtils
The i18n utils
|
protected int |
_nbCreatedContents
Number of created contents
|
protected int |
_nbDeletedContents
Number of deleted contents
|
protected int |
_nbError
Number of errors encountered
|
protected int |
_nbNotChangedContents
Number of unchanged contents
|
protected int |
_nbSynchronizedContents
Number of synchronized contents
|
protected ObservationManager |
_observationManager
The observation manager
|
protected AmetysObjectResolver |
_resolver
The ametys object resolver
|
protected BaseSynchroComponent |
_synchroComponent
The base SCC component
|
protected static String |
SCC_UNIQUE_ID
SCC unique ID field
|
_contentPrefix, _contentType, _id, _initialActionId, _label, _modelId, _modelParamValues, _removalSync, _reportMails, _restrictedField, _searchModelConfiguration, _synchronizeExistingContentsOnly, _synchronizingContentOperator, _validateActionId, _validateAfterImport, _workflowName
COLLECTION_ID_PROPERTY
Constructor and Description |
---|
AbstractSynchronizableContentsCollection() |
Modifier and Type | Method and Description |
---|---|
protected String |
_getContentPathQuery(String lang,
String idValue,
String contentType)
Construct the query to retrieve the content.
|
protected abstract List<Content> |
_getContentsToRemove(AmetysObjectIterable<ModifiableDefaultContent> contents)
Filter the contents to remove.
|
protected List<Expression> |
_getExpressionsList(String lang,
String idValue,
String contentType)
Construct the query to retrieve the content.
|
protected ModifiableCompositeMetadata |
_getMetadataHolder(ModifiableCompositeMetadata parentMetadata,
String metadataPath)
Get the metadata holder for the requested metadata path.
|
protected abstract List<ModifiableDefaultContent> |
_internalPopulate(Logger logger)
Internal implementation of
populate(Logger) |
protected boolean |
_isParamNotEmpty(Object parameterValue)
Check if the parameter value is empty
|
protected Map<String,Object> |
_removeEmptyParameters(Map<String,Object> parameters)
Remove empty parameters to the map
|
protected boolean |
_removeMetadataIfExists(ModifiableCompositeMetadata metadataHolder,
String metadataName,
boolean synchronize)
Remove the metadata if exists
|
protected boolean |
_synchronizeMetadata(ModifiableDefaultContent content,
ContentType contentType,
String logicalMetadataPath,
String completeMetadataPath,
List<Object> remoteValue,
boolean synchronize,
boolean create,
Logger logger)
Fill the metadata with remove value.
|
protected boolean |
_updateRelation(ModifiableCompositeMetadata metadataToEdit,
String metadataName,
Content content)
Update the invert relation by adding the new value (Content) to the old values.
|
protected boolean |
_updateRelation(ModifiableCompositeMetadata metadataToEdit,
String metadataName,
Content content,
boolean remove)
Update the invert relation by adding/removing the content to/from the old values.
|
protected boolean |
applyChanges(ModifiableDefaultContent content,
Integer actionId,
String event,
Logger logger)
Does workflow action
|
protected boolean |
applyChanges(ModifiableDefaultContent content,
Logger logger)
Does workflow action
|
protected ModifiableDefaultContent |
createContentAction(String contentType,
String workflowName,
int initialActionId,
String lang,
String contentTitle,
Logger logger)
Creates content action with result from request
|
protected void |
deleteUnexistingContents(Logger logger)
Delete contents created by a previous synchronization which does not exist anymore in remote source
|
List<ModifiableDefaultContent> |
populate(Logger logger)
Populates contents
|
protected void |
sendErrorMail(int nbError)
Sends the report mails
|
void |
service(ServiceManager manager) |
protected void |
updateSCCProperty(DefaultContent content)
Add the current synchronizable collection as property
|
protected void |
validateContent(WorkflowAwareContent content,
int validationActionId,
Logger logger)
Validates a content after import
|
_parseParameters, configure, configureDataSource, configureSearchModel, configureStaticParams, getContentPrefix, getContentType, getId, getInitialActionId, getLabel, getParameterValues, getReportMails, getRestrictedField, getSearchModelConfiguration, getSynchronizeCollectionModelId, getSynchronizingContentOperator, getValidateActionId, getWorkflowName, removalSync, synchronizeExistingContentsOnly, validateAfterImport
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getContent, getExternalOnlyFields, getIdField, getLocalAndExternalFields, getTotalCount, handleRightAssignmentContext, importContent, search, synchronizeContent, updateSyncInformations
protected static final String SCC_UNIQUE_ID
protected I18nUtils _i18nUtils
protected CurrentUserProvider _currentUserProvider
protected ObservationManager _observationManager
protected ContentDAO _contentDAO
protected AmetysObjectResolver _resolver
protected ContentTypeExtensionPoint _contentTypeEP
protected BaseSynchroComponent _synchroComponent
protected int _nbError
protected boolean _hasGlobalError
protected int _nbCreatedContents
protected int _nbSynchronizedContents
protected int _nbNotChangedContents
protected int _nbDeletedContents
public AbstractSynchronizableContentsCollection()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public List<ModifiableDefaultContent> populate(Logger logger)
SynchronizableContentsCollection
populate
in interface SynchronizableContentsCollection
logger
- The loggerprotected abstract List<ModifiableDefaultContent> _internalPopulate(Logger logger)
populate(Logger)
logger
- The loggerprotected void deleteUnexistingContents(Logger logger)
logger
- The loggerprotected abstract List<Content> _getContentsToRemove(AmetysObjectIterable<ModifiableDefaultContent> contents)
protected void sendErrorMail(int nbError) throws javax.mail.MessagingException
nbError
- The number of errorjavax.mail.MessagingException
- if a messaging error occurredprotected void validateContent(WorkflowAwareContent content, int validationActionId, Logger logger)
content
- The content to validatevalidationActionId
- Validation action ID to use for this contentlogger
- The loggerprotected boolean applyChanges(ModifiableDefaultContent content, Logger logger) throws RepositoryException
content
- The synchronized contentlogger
- The loggerRepositoryException
- if an error occurs when trying to rollback pending changes in the repository.protected boolean applyChanges(ModifiableDefaultContent content, Integer actionId, String event, Logger logger) throws RepositoryException
content
- The synchronized contentactionId
- Workflow actionevent
- Type of eventlogger
- The loggerRepositoryException
- if an error occurs when trying to rollback pending changes in the repository.protected ModifiableDefaultContent createContentAction(String contentType, String workflowName, int initialActionId, String lang, String contentTitle, Logger logger)
contentType
- Type of the content to createworkflowName
- Workflow to use for this contentinitialActionId
- Action ID for initializationlang
- The languagecontentTitle
- The content titlelogger
- The loggerprotected List<Expression> _getExpressionsList(String lang, String idValue, String contentType)
lang
- LangidValue
- Synchronization valuecontentType
- Content typeList
of Expression
protected String _getContentPathQuery(String lang, String idValue, String contentType)
lang
- LangidValue
- Synchronization valuecontentType
- Content typeprotected boolean _synchronizeMetadata(ModifiableDefaultContent content, ContentType contentType, String logicalMetadataPath, String completeMetadataPath, List<Object> remoteValue, boolean synchronize, boolean create, Logger logger)
content
- The content to synchronizecontentType
- The content typelogicalMetadataPath
- The logical metadata path without the entriescompleteMetadataPath
- The complete metadata path from the root of the contentremoteValue
- The remote valuesynchronize
- true
if synchronizablecreate
- true
if content is creating, false if it is updatedlogger
- The loggertrue
if changes were madeprotected boolean _removeMetadataIfExists(ModifiableCompositeMetadata metadataHolder, String metadataName, boolean synchronize)
metadataHolder
- The metadata holdermetadataName
- The name of the metadatasynchronize
- true
if the data is synchronizetrue
if the metadata have been removedprotected ModifiableCompositeMetadata _getMetadataHolder(ModifiableCompositeMetadata parentMetadata, String metadataPath)
parentMetadata
- Initial metadatametadataPath
- Metadata path from the parentprotected boolean _updateRelation(ModifiableCompositeMetadata metadataToEdit, String metadataName, Content content)
metadataToEdit
- Metadata holder to editmetadataName
- Metadata name to setcontent
- The content to add or removetrue
if there are changesprotected boolean _updateRelation(ModifiableCompositeMetadata metadataToEdit, String metadataName, Content content, boolean remove)
metadataToEdit
- Metadata holder to editmetadataName
- Metadata name to setcontent
- The content to add or removeremove
- true
if we wan't to remove the content from the relationtrue
if there are changesprotected void updateSCCProperty(DefaultContent content) throws RepositoryException
content
- The synchronized contentRepositoryException
- if an error occurredprotected Map<String,Object> _removeEmptyParameters(Map<String,Object> parameters)
parameters
- the parametersprotected boolean _isParamNotEmpty(Object parameterValue)
parameterValue
- the parameter value