public abstract class AbstractSynchronizableContentsCollection extends Object implements SynchronizableContentsCollection, Configurable, Serviceable
SynchronizableContentsCollection.| Modifier and Type | Field and Description |
|---|---|
protected ContentDAO |
_contentDAO
The content DAO
|
protected String |
_contentPrefix
The prefix of the contents
|
protected String |
_contentType
The handled content type
|
protected ContentTypeExtensionPoint |
_contentTypeEP
The content type extension point
|
protected ContentTypesHelper |
_contentTypesHelper
The helper for content types
|
protected CurrentUserProvider |
_currentUserProvider
The current user provider
|
private List<String> |
_handledContents |
protected boolean |
_hasGlobalError
True if there is a global error during synchronization
|
protected I18nUtils |
_i18nUtils
The i18n utils
|
protected String |
_id
The id
|
protected int |
_initialActionId
The id of the initial action of the workflow
|
protected I18nizableText |
_label
The label
|
protected LanguagesManager |
_languagesManager
The languges manager
|
protected String |
_modelId
The id of controller
|
protected Map<String,Object> |
_modelParamValues
The untyped values of controller's parameters
|
private int |
_nbCreatedContents |
private int |
_nbDeletedContents |
protected int |
_nbError
Number of errors encountered
|
private int |
_nbNotChangedContents |
private int |
_nbSynchronizedContents |
protected ObservationManager |
_observationManager
The observation manager
|
protected boolean |
_removalSync
True if removal sync
|
protected String |
_reportMails
The report mails
|
protected AmetysObjectResolver |
_resolver
The ametys object resolver
|
protected String |
_restrictedField
The path to the metadata holding the 'restricted' property
|
protected String |
_synchronizingContentOperator
The id of the content operator to use
|
protected SynchronizingContentOperatorExtensionPoint |
_synchronizingContentOperatorEP
The extension point for Synchronizing Content Operators
|
protected int |
_validateActionId
The id of the validate action of the workflow
|
protected boolean |
_validateAfterImport
True to validate contents after import
|
protected String |
_workflowName
The name of the workflow
|
protected WorkflowProvider |
_workflowProvider
The workflow provider
|
COLLECTION_ID_PROPERTY| Constructor and Description |
|---|
AbstractSynchronizableContentsCollection() |
| Modifier and Type | Method and Description |
|---|---|
private void |
_ensureTitleIsPresent(Content content,
Map<String,List<Object>> remoteValues,
Logger logger) |
protected ModifiableDefaultContent |
_getContent(String lang,
String idValue)
Gets the content in the repository
|
protected String |
_getContentName(String title,
String lang)
Gets the content name
|
private String |
_getContentPathQuery(String lang,
String idValue,
String contentType) |
protected String |
_getIdFieldValue(DefaultContent content)
Get the value of metadata holding the unique identifier of the synchronized content
|
private ModifiableCompositeMetadata |
_getMetadataHolder(ModifiableCompositeMetadata parentMetadata,
String metadataPath) |
protected void |
_handleContent(String id)
Adds the given content as handled (i.e.
|
protected abstract void |
_internalPopulate(Logger logger)
Internal implementation of
populate(Logger) |
protected boolean |
_isHandled(String id)
Returns true if the given content is handled
|
protected Map<String,Object> |
_parseParameters(Configuration configuration)
Parse parameters' values
|
private boolean |
_removeMetadataIfExists(ModifiableCompositeMetadata metadataHolder,
String metadataName,
boolean synchronize) |
private boolean |
_setMetadata(ModifiableCompositeMetadata metadataHolder,
String metadataName,
Object valueToSet,
boolean synchronize,
boolean forceExternalStatus) |
protected boolean |
applyChanges(ModifiableDefaultContent content,
Logger logger)
Does workflow action
|
void |
configure(Configuration configuration) |
protected String |
createContentAction(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
|
String |
getContentPrefix()
Get the prefix to use for the creation of contents
|
String |
getContentType()
Get the type of content handled by this collection
|
String |
getId()
Get the id of synchronizable collection.
|
int |
getInitialActionId()
Get the id of the initial action of the workflow
|
I18nizableText |
getLabel()
Get the label of synchronizable collection
|
Map<String,Object> |
getParameterValues()
Get the untyped values of parameters for controller
|
String |
getReportMails()
If an exception occurs during synchronization, an error report mail will be sent to those email addresses (separated by new lines)
|
String |
getRestrictedField()
Get the path of boolean metadata for restricted content.
|
String |
getSynchronizeCollectionModelId()
Get the id of controller responsible of synchronization of this collection
|
String |
getSynchronizingContentOperator()
Gets the id of the
SynchronizingContentOperator extension to use during synchronization |
int |
getValidateActionId()
Get the id of the validate action of the workflow
|
String |
getWorkflowName()
Get the name of the workflow to use for the synchronized contents
|
protected void |
importContent(String idValue,
Map<String,List<Object>> remoteValues,
Logger logger)
Imports or synchronizes a content for each available language
|
protected void |
importContent(String lang,
String idValue,
Map<String,List<Object>> remoteValues,
Logger logger)
Imports or synchronizes a content for given language
|
void |
populate(Logger logger)
Populates contents
|
boolean |
removalSync()
When returns true, a content created by a previous synchro will be removed if it does not exist anymore during the current synchro.
|
protected void |
sendErrorMail(int nbError)
Sends the report mails
|
void |
service(ServiceManager manager) |
protected boolean |
synchronizeContent(Map<String,List<Object>> remoteValues,
ContentType contentType,
ModifiableDefaultContent content,
boolean create,
Logger logger)
Synchronizes content
|
protected void |
updateSCCProperty(DefaultContent content)
Add the current synchronizable collection as property
|
boolean |
validateAfterImport()
True to validate the contents after import
|
protected void |
validateContent(WorkflowAwareContent content,
Logger logger)
Validates a content after import
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetExternalOnlyFields, getIdField, getLocalAndExternalFieldsprotected I18nizableText _label
protected String _restrictedField
protected String _contentType
protected Map<String,Object> _modelParamValues
protected boolean _removalSync
protected String _workflowName
protected int _initialActionId
protected int _validateActionId
protected String _contentPrefix
protected boolean _validateAfterImport
protected String _reportMails
protected String _synchronizingContentOperator
protected LanguagesManager _languagesManager
protected ContentTypeExtensionPoint _contentTypeEP
protected WorkflowProvider _workflowProvider
protected AmetysObjectResolver _resolver
protected ContentTypesHelper _contentTypesHelper
protected CurrentUserProvider _currentUserProvider
protected ObservationManager _observationManager
protected I18nUtils _i18nUtils
protected SynchronizingContentOperatorExtensionPoint _synchronizingContentOperatorEP
protected ContentDAO _contentDAO
protected int _nbError
protected boolean _hasGlobalError
private List<String> _handledContents
private int _nbCreatedContents
private int _nbSynchronizedContents
private int _nbNotChangedContents
private int _nbDeletedContents
public AbstractSynchronizableContentsCollection()
public void configure(Configuration configuration) throws ConfigurationException
configure in interface ConfigurableConfigurationExceptionpublic void service(ServiceManager manager) throws ServiceException
service in interface ServiceableServiceExceptionprotected Map<String,Object> _parseParameters(Configuration configuration) throws ConfigurationException
configuration - The root configurationConfigurationException - if an error occurredpublic String getId()
SynchronizableContentsCollectiongetId in interface SynchronizableContentsCollectionpublic I18nizableText getLabel()
SynchronizableContentsCollectiongetLabel in interface SynchronizableContentsCollectionpublic String getContentType()
SynchronizableContentsCollectiongetContentType in interface SynchronizableContentsCollectionpublic String getRestrictedField()
SynchronizableContentsCollectiongetRestrictedField in interface SynchronizableContentsCollectionpublic String getSynchronizeCollectionModelId()
SynchronizableContentsCollectiongetSynchronizeCollectionModelId in interface SynchronizableContentsCollectionpublic Map<String,Object> getParameterValues()
SynchronizableContentsCollectiongetParameterValues in interface SynchronizableContentsCollectionpublic boolean removalSync()
SynchronizableContentsCollectionremovalSync in interface SynchronizableContentsCollectionpublic String getWorkflowName()
SynchronizableContentsCollectiongetWorkflowName in interface SynchronizableContentsCollectionpublic int getInitialActionId()
SynchronizableContentsCollectiongetInitialActionId in interface SynchronizableContentsCollectionpublic int getValidateActionId()
SynchronizableContentsCollectiongetValidateActionId in interface SynchronizableContentsCollectionpublic String getContentPrefix()
SynchronizableContentsCollectiongetContentPrefix in interface SynchronizableContentsCollectionpublic boolean validateAfterImport()
SynchronizableContentsCollectionvalidateAfterImport in interface SynchronizableContentsCollectionpublic String getReportMails()
SynchronizableContentsCollectiongetReportMails in interface SynchronizableContentsCollectionpublic String getSynchronizingContentOperator()
SynchronizableContentsCollectionSynchronizingContentOperator extension to use during synchronizationgetSynchronizingContentOperator in interface SynchronizableContentsCollectionSynchronizingContentOperator extension to use during synchronizationpublic void populate(Logger logger)
SynchronizableContentsCollectionpopulate in interface SynchronizableContentsCollectionlogger - The loggerprotected void sendErrorMail(int nbError) throws javax.mail.MessagingException
nbError - The number of errorjavax.mail.MessagingException - if a messaging error occurredprotected abstract void _internalPopulate(Logger logger)
populate(Logger)logger - The loggerprotected void _handleContent(String id)
_removalSync is true)id - The id of the contentprotected boolean _isHandled(String id)
id - The content to testprotected void importContent(String idValue, Map<String,List<Object>> remoteValues, Logger logger)
idValue - The unique identifier of the contentremoteValues - The remote valueslogger - The loggerprotected void importContent(String lang, String idValue, Map<String,List<Object>> remoteValues, Logger logger)
lang - The languageidValue - The title of the contentremoteValues - The remote valueslogger - The loggerprivate void _ensureTitleIsPresent(Content content, Map<String,List<Object>> remoteValues, Logger logger)
protected void updateSCCProperty(DefaultContent content) throws RepositoryException
content - The synchronized contentRepositoryException - if an error occurredprotected ModifiableDefaultContent _getContent(String lang, String idValue)
lang - the languageidValue - the content nameprivate String _getContentPathQuery(String lang, String idValue, String contentType)
protected String createContentAction(String lang, String contentTitle, Logger logger)
lang - The languagecontentTitle - The content titlelogger - The loggerprotected String _getContentName(String title, String lang)
title - The namelang - The lang of the contentprotected boolean synchronizeContent(Map<String,List<Object>> remoteValues, ContentType contentType, ModifiableDefaultContent content, boolean create, Logger logger)
remoteValues - The remote valuescontentType - The content typecontent - The content to synchronizecreate - true if content is creating, false if it is updatedlogger - The loggerprivate boolean _removeMetadataIfExists(ModifiableCompositeMetadata metadataHolder, String metadataName, boolean synchronize)
private ModifiableCompositeMetadata _getMetadataHolder(ModifiableCompositeMetadata parentMetadata, String metadataPath)
private boolean _setMetadata(ModifiableCompositeMetadata metadataHolder, String metadataName, Object valueToSet, boolean synchronize, boolean forceExternalStatus)
protected void validateContent(WorkflowAwareContent content, Logger logger)
content - The content to validatelogger - 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 void deleteUnexistingContents(Logger logger)
logger - The loggerprotected String _getIdFieldValue(DefaultContent content)
content - The content