public abstract class AbstractSimpleSynchronizableContentsCollection extends AbstractSynchronizableContentsCollection
SynchronizableContentsCollection
.Modifier and Type | Field and Description |
---|---|
protected ContentHelper |
_contentHelper
The content helper
|
private List<String> |
_handledContents |
protected LanguagesManager |
_languagesManager
The languges manager
|
protected SynchronizableContentsCollectionHelper |
_sccHelper
SCC helper
|
protected SynchronizingContentOperatorExtensionPoint |
_synchronizingContentOperatorEP
The extension point for Synchronizing Content Operators
|
_contentDAO, _contentTypeEP, _currentUserProvider, _hasGlobalError, _i18nUtils, _nbCreatedContents, _nbDeletedContents, _nbError, _nbNotChangedContents, _nbSynchronizedContents, _observationManager, _resolver, _synchroComponent, SCC_UNIQUE_ID
_contentPrefix, _contentType, _id, _initialActionId, _label, _modelId, _modelParamValues, _removalSync, _reportMails, _restrictedField, _searchModelConfiguration, _synchronizeExistingContentsOnly, _synchronizingContentOperator, _validateActionId, _validateAfterImport, _workflowName
COLLECTION_ID_PROPERTY
Constructor and Description |
---|
AbstractSimpleSynchronizableContentsCollection() |
Modifier and Type | Method and Description |
---|---|
private void |
_ensureTitleIsPresent(Content content,
Map<String,List<Object>> remoteValues,
Logger logger) |
protected boolean |
_fillContent(Map<String,List<Object>> remoteValues,
ModifiableDefaultContent content,
boolean create,
Logger logger)
Fill the content with remote values.
|
protected List<Content> |
_getContentsToRemove(AmetysObjectIterable<ModifiableDefaultContent> contents)
Filter the contents to remove.
|
protected String |
_getIdFieldValue(DefaultContent content)
Get the value of metadata holding the unique identifier of the synchronized content
|
protected void |
_handleContent(String id)
Adds the given content as handled (i.e.
|
protected ModifiableDefaultContent |
_importContent(String idValue,
Map<String,Object> importParams,
String lang,
Map<String,List<Object>> remoteValues,
Logger logger)
Import a content from remote values.
|
protected List<ModifiableDefaultContent> |
_importOrSynchronizeContent(String idValue,
Map<String,List<Object>> remoteValues,
boolean forceImport,
Logger logger)
Imports or synchronizes a content for each available language
|
protected List<ModifiableDefaultContent> |
_importOrSynchronizeContent(String idValue,
String lang,
Map<String,List<Object>> remoteValues,
boolean forceImport,
Logger logger)
Imports or synchronizes a content for a given language
|
protected List<ModifiableDefaultContent> |
_importOrSynchronizeContents(Map<String,Object> searchParams,
boolean forceImport,
Logger logger)
Import or synchronize several contents from search params.
|
protected List<ModifiableDefaultContent> |
_internalPopulate(Logger logger)
Internal implementation of
AbstractSynchronizableContentsCollection.populate(Logger) |
protected boolean |
_isHandled(String id)
Returns true if the given content is handled
|
protected ModifiableDefaultContent |
_synchronizeContent(ModifiableDefaultContent content,
Map<String,List<Object>> remoteValues,
Logger logger)
Synchronize a content with remove values.
|
protected boolean |
additionalImportOperations(ModifiableDefaultContent content,
Map<String,List<Object>> remoteValues,
Map<String,Object> importParams,
Logger logger)
Add specific fields to the content.
|
protected boolean |
additionalSynchronizeOperations(ModifiableDefaultContent content,
Map<String,List<Object>> remoteValues,
Logger logger)
Add specific fields to the content.
|
void |
configure(Configuration configuration) |
protected ModifiableDefaultContent |
createContentAction(String lang,
String contentTitle,
Logger logger)
Creates content action with result from request
|
ModifiableDefaultContent |
getContent(String lang,
String idValue)
Gets the content in the repository
|
protected abstract Map<String,Map<String,List<Object>>> |
getRemoteValues(Map<String,Object> parameters,
Logger logger)
Search values and return the result organized by metadata
|
int |
getTotalCount(Map<String,Object> parameters,
Logger logger)
Return the total number of results for the search.
|
protected Map<String,Map<String,List<Object>>> |
getTransformedRemoteValues(Map<String,Object> parameters,
Logger logger)
Search values and return the result organized by metadata and transformed by the
SynchronizingContentOperator if exists. |
List<ModifiableDefaultContent> |
importContent(String idValue,
Map<String,Object> importParams,
Logger logger)
Import a content from remote values.
|
protected abstract Map<String,Map<String,Object>> |
internalSearch(Map<String,Object> parameters,
int offset,
int limit,
List<Object> sort,
Logger logger)
Search values and return the result without any treatment.
|
List<ModifiableDefaultContent> |
populate(Logger logger)
Populates contents
|
protected abstract Map<String,Object> |
putIdParameter(String idValue)
Set search parameters for the ID value.
|
Map<String,Map<String,Object>> |
search(Map<String,Object> parameters,
int offset,
int limit,
List<Object> sort,
Logger logger)
Search the data to import from parameters.
|
void |
service(ServiceManager manager) |
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).
|
protected void |
validateContent(WorkflowAwareContent content,
Logger logger)
Validates a content after import
|
_getContentPathQuery, _getExpressionsList, _getMetadataHolder, _isParamNotEmpty, _removeEmptyParameters, _removeMetadataIfExists, _synchronizeMetadata, _updateRelation, _updateRelation, applyChanges, applyChanges, createContentAction, deleteUnexistingContents, sendErrorMail, updateSCCProperty, validateContent
_parseParameters, 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
getExternalOnlyFields, getIdField, getLocalAndExternalFields, handleRightAssignmentContext
protected LanguagesManager _languagesManager
protected SynchronizingContentOperatorExtensionPoint _synchronizingContentOperatorEP
protected SynchronizableContentsCollectionHelper _sccHelper
protected ContentHelper _contentHelper
private List<String> _handledContents
public AbstractSimpleSynchronizableContentsCollection()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
service
in class AbstractSynchronizableContentsCollection
ServiceException
public void configure(Configuration configuration) throws ConfigurationException
configure
in interface Configurable
configure
in class AbstractStaticSynchronizableContentsCollection
ConfigurationException
public List<ModifiableDefaultContent> populate(Logger logger)
SynchronizableContentsCollection
populate
in interface SynchronizableContentsCollection
populate
in class AbstractSynchronizableContentsCollection
logger
- The loggerprotected List<ModifiableDefaultContent> _internalPopulate(Logger logger)
AbstractSynchronizableContentsCollection
AbstractSynchronizableContentsCollection.populate(Logger)
_internalPopulate
in class AbstractSynchronizableContentsCollection
logger
- The loggerprotected void _handleContent(String id)
id
- The id of the contentprotected boolean _isHandled(String id)
id
- The content to testprotected List<ModifiableDefaultContent> _importOrSynchronizeContent(String idValue, Map<String,List<Object>> remoteValues, boolean forceImport, Logger logger)
idValue
- The unique identifier of the contentremoteValues
- The remote valuesforceImport
- To force import and ignoring the synchronize existing contents only optionlogger
- The loggerprotected List<ModifiableDefaultContent> _importOrSynchronizeContent(String idValue, String lang, Map<String,List<Object>> remoteValues, boolean forceImport, Logger logger)
idValue
- The unique identifier of the contentlang
- The language of content to import or synchronizeremoteValues
- The remote valuesforceImport
- To force import and ignoring the synchronize existing contents only optionlogger
- The loggerpublic void synchronizeContent(ModifiableDefaultContent content, Logger logger) throws Exception
SynchronizableContentsCollection
content
- The content to synchronizelogger
- The loggerException
- if an error occurs.protected ModifiableDefaultContent _synchronizeContent(ModifiableDefaultContent content, Map<String,List<Object>> remoteValues, Logger logger) throws Exception
content
- The content to synchronizeremoteValues
- Values to synchronizelogger
- The loggerException
- if an error occurs.public List<ModifiableDefaultContent> importContent(String idValue, Map<String,Object> importParams, Logger logger) throws Exception
SynchronizableContentsCollection
idValue
- Id (for import/synchronization) of the content to importimportParams
- Additional parameterslogger
- The loggerException
- if an error occurs.protected abstract Map<String,Object> putIdParameter(String idValue)
idValue
- Value to searchprotected ModifiableDefaultContent _importContent(String idValue, Map<String,Object> importParams, String lang, Map<String,List<Object>> remoteValues, Logger logger) throws Exception
idValue
- Id (for import/synchronization) of the content to importimportParams
- Specific parameters for importlang
- Lang of the contentremoteValues
- Values of the contentlogger
- The loggerException
- if an error occurs.protected boolean additionalImportOperations(ModifiableDefaultContent content, Map<String,List<Object>> remoteValues, Map<String,Object> importParams, Logger logger)
content
- Content to updateremoteValues
- Values of the contentimportParams
- Import parameterslogger
- The loggertrue
if there are changesprotected boolean additionalSynchronizeOperations(ModifiableDefaultContent content, Map<String,List<Object>> remoteValues, Logger logger)
content
- Content to updateremoteValues
- Values of the contentlogger
- The loggertrue
if there are changesprivate void _ensureTitleIsPresent(Content content, Map<String,List<Object>> remoteValues, Logger logger)
public ModifiableDefaultContent getContent(String lang, String idValue)
SynchronizableContentsCollection
lang
- the languageidValue
- the content nameprotected ModifiableDefaultContent createContentAction(String lang, String contentTitle, Logger logger)
lang
- The languagecontentTitle
- The content titlelogger
- The loggerprotected boolean _fillContent(Map<String,List<Object>> remoteValues, ModifiableDefaultContent content, boolean create, Logger logger)
remoteValues
- The remote valuescontent
- The content to synchronizecreate
- true
if content is creating, false if it is updatedlogger
- The loggertrue
if changes were madeprotected void validateContent(WorkflowAwareContent content, Logger logger)
content
- The content to validatelogger
- The loggerprotected String _getIdFieldValue(DefaultContent content)
content
- The contentpublic Map<String,Map<String,Object>> search(Map<String,Object> parameters, int offset, int limit, List<Object> sort, Logger logger)
SynchronizableContentsCollection
parameters
- Parameters for the searchoffset
- Begin of the searchlimit
- Number of resultssort
- Sort of results (ignored for LDAP results)logger
- The loggerprotected abstract Map<String,Map<String,Object>> internalSearch(Map<String,Object> parameters, int offset, int limit, List<Object> sort, Logger logger)
parameters
- Search parameters to restrict the searchoffset
- Begin of the searchlimit
- Number of resultssort
- Sort of results (ignored for LDAP results)logger
- The loggerprotected Map<String,Map<String,List<Object>>> getTransformedRemoteValues(Map<String,Object> parameters, Logger logger)
SynchronizingContentOperator
if exists.parameters
- Search parameters to restrict the searchlogger
- The loggerprotected abstract Map<String,Map<String,List<Object>>> getRemoteValues(Map<String,Object> parameters, Logger logger)
parameters
- Search parameters to restrict the searchlogger
- The loggerpublic void updateSyncInformations(ModifiableDefaultContent content, String syncCode, Logger logger) throws Exception
SynchronizableContentsCollection
content
- Content to updatesyncCode
- New synchronization codelogger
- The loggerException
- if an error occurs.public int getTotalCount(Map<String,Object> parameters, Logger logger)
SynchronizableContentsCollection
parameters
- Parameters for the searchlogger
- The loggerprotected List<ModifiableDefaultContent> _importOrSynchronizeContents(Map<String,Object> searchParams, boolean forceImport, Logger logger)
searchParams
- Search parametersforceImport
- To force import and ignoring the synchronize existing contents only optionlogger
- The loggerList
of imported or synchronized ModifiableDefaultContent
protected List<Content> _getContentsToRemove(AmetysObjectIterable<ModifiableDefaultContent> contents)
AbstractSynchronizableContentsCollection
_getContentsToRemove
in class AbstractSynchronizableContentsCollection
contents
- The list of all the available contentsList
of Content
to remove.