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
FieldsModifier and TypeFieldDescriptionprotected CatalogsManagerThe catalogs managerMap to link contents to its children at the end of the processList of imported contentsprotected JSONUtilsThe JSON utilsMapping between metadata and columnsprotected StringDefault language configured for ODFprotected PegaseApiManagerThe Pégase API managerSearch fields to displayprotected StringThe 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, _synchronizingContentOperatorEPFields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_contentWorkflowHelper, _currentUserProvider, _hasGlobalError, _i18nUtils, _nbCreatedContents, _nbDeletedContents, _nbError, _nbNotChangedContents, _nbSynchronizedContents, _observationManager, SCC_UNIQUE_IDFields 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, _workflowNameFields 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
Constructors -
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 ContentWorkflowDescriptionGet 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 voidconfigureDataSource(Configuration configuration) Configure the data source parameters.protected voidConfigure the search model used by SCCSearchTool.protected StringGet the catalog for import.protected StringGet 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 attributesintgetTotalCount(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.voidservice(ServiceManager manager) voidsynchronizeContent(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, validateContentMethods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_deleteContents, _getAdditionalInputsForContentCreation, _getContentPathQuery, _hasSomethingChanged, _internalPopulate, _isParamNotEmpty, _logSynchronizationResult, _removeEmptyParameters, createContentAction, deleteUnexistingContents, empty, getSynchronizationResult, sendErrorMail, validateContentMethods 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, validateAfterImportMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
servicein interfaceServiceable- Overrides:
servicein classAbstractSimpleSynchronizableContentsCollection- Throws:
ServiceException
-
getIdField
Description copied from interface:SynchronizableContentsCollectionGet 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:SynchronizableContentsCollectionGet the path of tri-state fields (with local and external values)- Parameters:
additionalParameters- Additional parameters- Returns:
- the synchronized fields
-
putIdParameter
Description copied from class:AbstractSimpleSynchronizableContentsCollectionSet search parameters for the ID value.- Specified by:
putIdParameterin classAbstractSimpleSynchronizableContentsCollection- Parameters:
idValue- Value to search- Returns:
- Map with the search parameters
-
configureDataSource
Description copied from class:AbstractStaticSynchronizableContentsCollectionConfigure the data source parameters.- Specified by:
configureDataSourcein classAbstractStaticSynchronizableContentsCollection- Parameters:
configuration- Configuration to read- Throws:
ConfigurationException- If an error occurs
-
configureSearchModel
Description copied from class:AbstractStaticSynchronizableContentsCollectionConfigure the search model used by SCCSearchTool.- Specified by:
configureSearchModelin 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:AbstractSimpleSynchronizableContentsCollectionSearch values and return the result without any treatment.- Specified by:
internalSearchin 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:SynchronizableContentsCollectionReturn the total number of results for the search.- Specified by:
getTotalCountin interfaceSynchronizableContentsCollection- Overrides:
getTotalCountin 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:AbstractSimpleSynchronizableContentsCollectionSearch values and return the result organized by attributes- Specified by:
getRemoteValuesin 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:SynchronizableContentsCollectionImport a content from remote values.- Specified by:
importContentin interfaceSynchronizableContentsCollection- Overrides:
importContentin 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:SynchronizableContentsCollectionSynchronize a content with remove values.- Specified by:
synchronizeContentin interfaceSynchronizableContentsCollection- Overrides:
synchronizeContentin 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:AbstractSimpleSynchronizableContentsCollectionImport or synchronize several contents from search params.- Overrides:
_importOrSynchronizeContentsin classAbstractSimpleSynchronizableContentsCollection- Parameters:
searchParams- Search parametersforceImport- To force import and ignoring the synchronize existing contents only optionlogger- The loggerprogressionTracker- The progression tracker- Returns:
- The
Listof 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-trueto 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:AbstractSimpleSynchronizableContentsCollectionImports or synchronizes a content for a given language- Overrides:
_importOrSynchronizeContentin 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:AbstractSimpleSynchronizableContentsCollectionSynchronize a content with remove values.- Overrides:
_synchronizeContentin 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:AbstractSimpleSynchronizableContentsCollectionFill the content with remote values.- Overrides:
_fillContentin classAbstractSimpleSynchronizableContentsCollection- Parameters:
remoteValues- The remote valuescontent- The content to synchronizeadditionalParameters- Additional parameterscreate-trueif content is creating, false if it is updatedlogger- The logger- Returns:
trueif the content has been modified,falseotherwise- Throws:
Exception- if an error occurs
-
getLanguages
Description copied from interface:SynchronizableContentsCollectionGet the languages handled by this collection- Specified by:
getLanguagesin interfaceSynchronizableContentsCollection- Overrides:
getLanguagesin classAbstractStaticSynchronizableContentsCollection- Returns:
- the list of language
-
_getExpressionsList
Description copied from class:AbstractSynchronizableContentsCollectionConstruct the query to retrieve the content.- Overrides:
_getExpressionsListin classAbstractSynchronizableContentsCollection- Parameters:
lang- LangidValue- Synchronization valuecontentType- Content type- Returns:
- The
ListofExpression
-
_transformRemoteValuesCardinality
protected Map<String,Object> _transformRemoteValuesCardinality(Map<String, List<Object>> remoteValues, String obsoleteContentTypeId) Description copied from class:AbstractStaticSynchronizableContentsCollectionTransform the remote values to take each attribute cardinality into account- Overrides:
_transformRemoteValuesCardinalityin classAbstractStaticSynchronizableContentsCollection- Parameters:
remoteValues- the remote valuesobsoleteContentTypeId- the content type ID from which attributes come from- Returns:
- the transformed values
-