Class PegaseSynchronizableContentsCollection
java.lang.Object
org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
org.ametys.plugins.odfsync.pegase.scc.PegaseSynchronizableContentsCollection
- All Implemented Interfaces:
SynchronizableContentsCollection
,Configurable
,Serviceable
public class PegaseSynchronizableContentsCollection
extends AbstractSimpleSynchronizableContentsCollection
SCC for Pegase (COF).
-
Field Summary
Modifier and TypeFieldDescriptionprotected CatalogsManager
The catalogs managerMap to link contents to its children at the end of the processList of imported contentsprotected JSONUtils
The JSON utilsMapping between metadata and columnsprotected String
Default language configured for ODFprotected PegaseApiManager
The Pégase API managerSearch fields to displayprotected String
The structure code for PégaseList of synchronized contents having differencesList of updated contents by relationFields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
_contentHelper, _synchronizingContentOperatorEP
Fields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_contentWorkflowHelper, _currentUserProvider, _hasGlobalError, _i18nUtils, _nbCreatedContents, _nbDeletedContents, _nbError, _nbNotChangedContents, _nbSynchronizedContents, _observationManager, SCC_UNIQUE_ID
Fields 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 boolean
_fillContent
(Map<String, List<Object>> remoteValues, ModifiableContent content, Map<String, Object> additionalParameters, boolean create, Logger logger) Fill the content with remote values.protected ModifiableContent
_getContent
(String lang, String syncCode, String contentType) Get the content from the synchronization code, the lang, the catalog and the content type.protected List<Expression>
_getExpressionsList
(String lang, String idValue, String contentType) Construct the query to retrieve the content.protected ModifiableContent
_getOrCreateContent
(String lang, String idValue, Map<String, List<Object>> remoteValues, boolean forceImport, Logger logger) Get or create the content defined by the given parameters.protected Optional<ModifiableContent>
_importOrSynchronizeContent
(String idValue, String lang, Map<String, List<Object>> remoteValues, boolean forceImport, Logger logger) Imports or synchronizes a content for a given languageprotected List<ModifiableContent>
_importOrSynchronizeContents
(Map<String, Object> searchParams, boolean forceImport, Logger logger, ContainerProgressionTracker progressionTracker) Import or synchronize several contents from search params.protected ContentWorkflowDescription
Get the workflow description for the given object type.protected ModifiableContent
_synchronizeContent
(ModifiableContent content, Map<String, List<Object>> remoteValues, Logger logger) Synchronize a content with remove values._transformRemoteValuesCardinality
(Map<String, List<Object>> remoteValues, String obsoleteContentTypeId) Transform the remote values to take each attribute cardinality into accountprotected void
configureDataSource
(Configuration configuration) Configure the data source parameters.protected void
Configure the search model used by SCCSearchTool.protected String
Get the catalog for import.protected String
Get the identifier JSON field.Get the path of metadata holding the unique identifierGet the languages handled by this collectiongetLocalAndExternalFields
(Map<String, Object> additionalParameters) Get the path of tri-state fields (with local and external values)getRemoteValues
(Map<String, Object> parameters, Logger logger) Search values and return the result organized by attributesint
getTotalCount
(Map<String, Object> searchParameters, Logger logger) Return the total number of results for the search.Import a content from remote values.internalSearch
(Map<String, Object> parameters, int offset, int limit, List<Object> sort, Logger logger) Search values and return the result without any treatment.putIdParameter
(String idValue) Set search parameters for the ID value.void
service
(ServiceManager manager) void
synchronizeContent
(ModifiableContent content, Logger logger) Synchronize a content with remove values.Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
_addEditInputsForSCC, _editContent, _getContentsToRemove, _getEditInputs, _getEditInputsContextParameters, _handleContent, _importContent, _importOrSynchronizeContent, _importOrSynchronizeContents, _internalPopulate, _isHandled, _transformRemoteValues, configure, createContentAction, getAdditionalAttributeValues, getContent, getNotSynchronizedRelatedContentIds, getTransformedRemoteValues, populate, search, updateSyncInformations, validateContent
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_deleteContents, _getAdditionalInputsForContentCreation, _getContentPathQuery, _hasSomethingChanged, _internalPopulate, _isParamNotEmpty, _logSynchronizationResult, _removeEmptyParameters, createContentAction, deleteUnexistingContents, empty, getSynchronizationResult, sendErrorMail, validateContent
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_parseLanguages, _parseParameters, configureStaticParams, getContentPrefix, getContentType, getId, getInitialActionId, getLabel, 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, handleRightAssignmentContext
-
Field Details
-
_jsonUtils
The JSON utils -
_catalogsManager
The catalogs manager -
_pegaseApiManager
The Pégase API manager -
_mappingByContentType
Mapping between metadata and columns -
_searchFields
Search fields to display -
_importedContents
List of imported contents -
_synchronizedContents
List of synchronized contents having differences -
_updatedRelationContents
List of updated contents by relation -
_contentsChildren
Map to link contents to its children at the end of the process -
_odfLang
Default language configured for ODF -
_structureCode
The structure code for Pégase
-
-
Constructor Details
-
PegaseSynchronizableContentsCollection
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSimpleSynchronizableContentsCollection
- Throws:
ServiceException
-
getIdField
Description copied from interface:SynchronizableContentsCollection
Get the path of metadata holding the unique identifier- Returns:
- the path to the metadata. Can be null.
-
getIdColumn
Get the identifier JSON field.- Returns:
- the column id
-
getLocalAndExternalFields
Description copied from interface:SynchronizableContentsCollection
Get the path of tri-state fields (with local and external values)- Parameters:
additionalParameters
- Additional parameters- Returns:
- the synchronized fields
-
putIdParameter
Description copied from class:AbstractSimpleSynchronizableContentsCollection
Set search parameters for the ID value.- Specified by:
putIdParameter
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
idValue
- Value to search- Returns:
- Map with the search parameters
-
configureDataSource
Description copied from class:AbstractStaticSynchronizableContentsCollection
Configure the data source parameters.- Specified by:
configureDataSource
in classAbstractStaticSynchronizableContentsCollection
- Parameters:
configuration
- Configuration to read- Throws:
ConfigurationException
- If an error occurs
-
configureSearchModel
Description copied from class:AbstractStaticSynchronizableContentsCollection
Configure the search model used by SCCSearchTool.- Specified by:
configureSearchModel
in classAbstractStaticSynchronizableContentsCollection
-
getCatalog
Get the catalog for import.- Returns:
- the catalog
-
internalSearch
protected Map<String,Map<String, internalSearchObject>> (Map<String, Object> parameters, int offset, int limit, List<Object> sort, Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollection
Search values and return the result without any treatment.- Specified by:
internalSearch
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
parameters
- Search parameters to restrict the searchoffset
- Begin of the searchlimit
- Number of resultssort
- Sort of results (ignored for LDAP results)logger
- The logger- Returns:
- Map of results without any treatment.
-
getTotalCount
Description copied from interface:SynchronizableContentsCollection
Return the total number of results for the search.- Specified by:
getTotalCount
in interfaceSynchronizableContentsCollection
- Overrides:
getTotalCount
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
searchParameters
- Parameters for the searchlogger
- The logger- Returns:
- The total count
-
getRemoteValues
protected Map<String,Map<String, getRemoteValuesList<Object>>> (Map<String, Object> parameters, Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollection
Search values and return the result organized by attributes- Specified by:
getRemoteValues
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
parameters
- Search parameters to restrict the searchlogger
- The logger- Returns:
- Map of results organized by attributes.
-
_mapWorkflowDescription
protected ContentWorkflowDescription _mapWorkflowDescription(String type) throws IllegalArgumentException Get the workflow description for the given object type.- Parameters:
type
- The type- Returns:
- the matching workflow description
- Throws:
IllegalArgumentException
- if the given categorie does not match any content workflow
-
importContent
public List<ModifiableContent> importContent(String idValue, Map<String, Object> importParams, Logger logger) throws ExceptionDescription copied from interface:SynchronizableContentsCollection
Import a content from remote values.- Specified by:
importContent
in interfaceSynchronizableContentsCollection
- Overrides:
importContent
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
idValue
- Id (for import/synchronization) of the content to importimportParams
- Additional parameterslogger
- The logger- Returns:
- A list of created contents
- Throws:
Exception
- if an error occurs.
-
synchronizeContent
Description copied from interface:SynchronizableContentsCollection
Synchronize a content with remove values.- Specified by:
synchronizeContent
in interfaceSynchronizableContentsCollection
- Overrides:
synchronizeContent
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
content
- The content to synchronizelogger
- The logger- Throws:
Exception
- if an error occurs.
-
_importOrSynchronizeContents
protected List<ModifiableContent> _importOrSynchronizeContents(Map<String, Object> searchParams, boolean forceImport, Logger logger, ContainerProgressionTracker progressionTracker) Description copied from class:AbstractSimpleSynchronizableContentsCollection
Import or synchronize several contents from search params.- Overrides:
_importOrSynchronizeContents
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
searchParams
- Search parametersforceImport
- To force import and ignoring the synchronize existing contents only optionlogger
- The loggerprogressionTracker
- The progression tracker- Returns:
- The
List
of imported or synchronizedModifiableContent
-
_getOrCreateContent
protected ModifiableContent _getOrCreateContent(String lang, String idValue, Map<String, List<Object>> remoteValues, boolean forceImport, Logger logger) throws ExceptionGet or create the content defined by the given parameters.- Parameters:
lang
- The content languageidValue
- The synchronization coderemoteValues
- The remote valuesforceImport
-true
to force import (only on single import or unlimited global synchronization)logger
- The logger- Returns:
- the content
- Throws:
Exception
- if an error occurs
-
_getContent
Get the content from the synchronization code, the lang, the catalog and the content type.- Parameters:
lang
- The langsyncCode
- The synchronization codecontentType
- The content type- Returns:
- the retrieved content
-
_importOrSynchronizeContent
protected Optional<ModifiableContent> _importOrSynchronizeContent(String idValue, String lang, Map<String, List<Object>> remoteValues, boolean forceImport, Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollection
Imports or synchronizes a content for a given language- Overrides:
_importOrSynchronizeContent
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
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 logger- Returns:
- The imported or synchronized content
-
_synchronizeContent
protected ModifiableContent _synchronizeContent(ModifiableContent content, Map<String, List<Object>> remoteValues, Logger logger) throws ExceptionDescription copied from class:AbstractSimpleSynchronizableContentsCollection
Synchronize a content with remove values.- Overrides:
_synchronizeContent
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
content
- The content to synchronizeremoteValues
- Values to synchronizelogger
- The logger- Returns:
- The synchronized content
- Throws:
Exception
- if an error occurs
-
_fillContent
protected boolean _fillContent(Map<String, List<Object>> remoteValues, ModifiableContent content, Map<String, throws ExceptionObject> additionalParameters, boolean create, Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollection
Fill the content with remote values.- Overrides:
_fillContent
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
remoteValues
- The remote valuescontent
- The content to synchronizeadditionalParameters
- Additional parameterscreate
-true
if content is creating, false if it is updatedlogger
- The logger- Returns:
true
if the content has been modified,false
otherwise- Throws:
Exception
- if an error occurs
-
getLanguages
Description copied from interface:SynchronizableContentsCollection
Get the languages handled by this collection- Specified by:
getLanguages
in interfaceSynchronizableContentsCollection
- Overrides:
getLanguages
in classAbstractStaticSynchronizableContentsCollection
- Returns:
- the list of language
-
_getExpressionsList
Description copied from class:AbstractSynchronizableContentsCollection
Construct the query to retrieve the content.- Overrides:
_getExpressionsList
in classAbstractSynchronizableContentsCollection
- Parameters:
lang
- LangidValue
- Synchronization valuecontentType
- Content type- Returns:
- The
List
ofExpression
-
_transformRemoteValuesCardinality
protected Map<String,Object> _transformRemoteValuesCardinality(Map<String, List<Object>> remoteValues, String obsoleteContentTypeId) Description copied from class:AbstractStaticSynchronizableContentsCollection
Transform the remote values to take each attribute cardinality into account- Overrides:
_transformRemoteValuesCardinality
in classAbstractStaticSynchronizableContentsCollection
- Parameters:
remoteValues
- the remote valuesobsoleteContentTypeId
- the content type ID from which attributes come from- Returns:
- the transformed values
-