Class AbstractApogeeSynchronizableContentsCollection
- 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.apogee.scc.AbstractApogeeSynchronizableContentsCollection
-
- All Implemented Interfaces:
SynchronizableContentsCollection
,ApogeeSynchronizableContentsCollection
,Configurable
,Contextualizable
,Serviceable
- Direct Known Subclasses:
AbstractApogeeSynchronizableContentsWithCatalogCollection
,OrgUnitSynchronizableContentsCollection
public abstract class AbstractApogeeSynchronizableContentsCollection extends AbstractSimpleSynchronizableContentsCollection implements Contextualizable, ApogeeSynchronizableContentsCollection
Abstract class for Apogee synchronization
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
__PARAM_COLUMNS
Name of paramter holding columnsprotected static String
__PARAM_COLUMNS_COLUMN
Name of paramter into columns holding columnprotected static String
__PARAM_CRITERIA
Name of parameter holding the criteriaprotected static String
__PARAM_CRITERIA_CRITERION
Name of parameter into criteria holding a criterionprotected static String
__PARAM_CRITERIA_CRITERION_ID
Name of parameter into criterion holding the idprotected static String
__PARAM_CRITERIA_CRITERION_LABEL
Name of parameter into criterion holding the labelprotected static String
__PARAM_CRITERIA_CRITERION_TYPE
Name of parameter into criterion holding the typeprotected static String
__PARAM_ID_COLUMN
Name of parameter holding the field ID columnprotected static String
__PARAM_MAPPING
Name of parameter holding the fields mappingprotected static String
__PARAM_MAPPING_ATTRIBUTE
Name of parameter into mapping holding the remote attributeprotected static String
__PARAM_MAPPING_METADATA_REF
Name of parameter into mapping holding the path of metadataprotected static String
__PARAM_MAPPING_SYNCHRO
Name of parameter into mapping holding the synchronized propertyprotected ApogeeDAO
_apogeeDAO
The DAO for remote DB Apogeeprotected ApogeeSynchronizableContentsCollectionHelper
_apogeeSCCHelper
The Apogee SCC helperprotected Set<String>
_columns
Synchronized fieldsprotected Context
_context
Contextprotected Set<ApogeeCriterion>
_criteria
Synchronized fieldsprotected String
_idColumn
Name of the Apogée column which contains the IDprotected JSONUtils
_jsonUtils
The JSON utilsprotected Map<String,List<String>>
_mapping
Mapping between metadata and columnsprotected ODFHelper
_odfHelper
The ODF helperprotected String
_odfLang
Default language configured for ODFprotected SynchronizableContentsCollectionDAO
_sccDAO
SCC DAOprotected Set<String>
_syncFields
Synchronized fieldsstatic String
PARAM_ADD_UNEXISTING_CHILDREN
Name of parameter holding the adding unexisting children parameterstatic String
PARAM_DATASOURCE_ID
Name of parameter holding the data source idstatic String
PARAM_YEAR
Name of parameter holding the administrative year-
Fields 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, _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, RESULT_NB_CREATED_CONTENTS, RESULT_NB_DELETED_CONTENTS, RESULT_NB_NOT_CHANGED_CONTENTS, RESULT_NB_SYNCHRONIZED_CONTENTS
-
-
Constructor Summary
Constructors Constructor Description AbstractApogeeSynchronizableContentsCollection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected List<ModifiableContent>
_addUnexistingChildren(SynchronizableContentsCollection scc, Set<String> childrenRemoteSyncCode, org.slf4j.Logger logger)
Add unexisting children in Ametys from Apogeeprotected Object
_convertBigDecimal(String contentTypeId, String attributeName, Object objectToConvert)
Convert the object in parameter to a long if it's aBigDecimal
, otherwise return the object itself.protected List<Map<String,Object>>
_convertBigDecimal(List<Map<String,Object>> searchResults)
Convert theBigDecimal
values retrieved from database into long valuesprotected Set<String>
_getChildrenRemoteSyncCode(Content content, SynchronizableContentsCollection scc, org.slf4j.Logger logger)
Get the remote sync codesprotected String
_getSort(List<Object> sortList)
protected List<ModifiableContent>
_importChildren(String idValue, SynchronizableContentsCollection scc, org.slf4j.Logger logger)
Import childrenprotected ModifiableContent
_importContent(String idValue, Map<String,Object> additionalParameters, String lang, Map<String,List<Object>> remoteValues, org.slf4j.Logger logger)
Import a content from remote values.protected Stream<ModifiableContent>
_importUnexistingChildren(SynchronizableContentsCollection scc, String syncCode, Map<String,List<Object>> additionalParameters, org.slf4j.Logger logger)
Import an unexisting child in Ametysprotected List<ModifiableContent>
_internalPopulate(org.slf4j.Logger logger)
Internal implementation ofAbstractSynchronizableContentsCollection.populate(Logger)
protected boolean
_isChildWillBeRemoved(ModifiableContent content, SynchronizableContentsCollection scc, Set<String> childrenRemoteSyncCode, org.slf4j.Logger logger)
True if the content will be removed from the structureprotected abstract List<Map<String,Object>>
_search(Map<String,Object> searchParameters, org.slf4j.Logger logger)
Search the contents with the search parameters.protected List<ModifiableContent>
_synchronizeChildren(Content content, SynchronizableContentsCollection scc, String attributeName, org.slf4j.Logger logger)
Synchronize childrenprotected ModifiableContent
_synchronizeContent(ModifiableContent content, Map<String,List<Object>> remoteValues, org.slf4j.Logger logger)
Synchronize a content with remove values.protected Object
_transformClobToString(Object value, String idValue, org.slf4j.Logger logger)
Transform CLOB value to String value.protected Map<String,List<Object>>
_transformListOfMap2MapOfList(List<Map<String,Object>> lines)
protected boolean
addUnexistingChildren()
Check if unexisting contents in Ametys should be added from data sourceprotected void
configureDataSource(Configuration configuration)
Configure the data source parameters.protected void
configureSearchModel()
Configure the search model used by SCCSearchTool.void
contextualize(Context context)
protected Map<String,Object>
getAdditionalAttributeValues(String idValue, Content content, Map<String,Object> additionalParameters, boolean create, org.slf4j.Logger logger)
Retrieves additional values to synchronize for a contentprotected abstract String
getChildrenAttributeName()
Get the attribute name to get childrenprotected String
getChildrenSCCModelId()
Get the children SCC model id.protected Set<String>
getClobColumns()
Get the list of CLOB column's names.protected String
getDataSourceId()
Get the id of data sourceprotected String
getIdColumn()
Get the identifier column (can be a concatened column).String
getIdField()
Get the path of metadata holding the unique identifierList<String>
getLanguages()
Get the languages handled by this collectionSet<String>
getLocalAndExternalFields(Map<String,Object> additionalParameters)
Get the path of tri-state fields (with local and external values)protected abstract String
getMappingName()
Get the name of the mapping.protected Set<String>
getNotSynchronizedRelatedContentIds(Content content, Map<String,Object> contentValues, Map<String,Object> additionalParameters, String lang, org.slf4j.Logger logger)
Retrieves the ids of the contents related to the given content but that are not part of the synchronizationprotected Pair<String,Object>
getParentAttribute(ModifiableContent parent)
Retrieves the attribute to synchronize for the given parent (as aPair
of name and value)protected Optional<ModifiableContent>
getParentFromAdditionalParameters(Map<String,Object> additionalParameters)
Retrieves the parent id, extracted from additional parametersprotected Optional<String>
getParentIdFromAdditionalParameters(Map<String,Object> additionalParameters)
Retrieves the parent id, extracted from additional parametersprotected Map<String,Map<String,List<Object>>>
getRemoteValues(Map<String,Object> searchParameters, org.slf4j.Logger logger)
Search values and return the result organized by attributesprotected Set<String>
getRichTextFields()
Get the list of rich text fields of the imported content.int
getTotalCount(Map<String,Object> searchParameters, org.slf4j.Logger logger)
Return the total number of results for the search.protected String
getYear()
Get the administrative yearprotected List<ModifiableContent>
handleChildren(String idValue, Content content, boolean create, org.slf4j.Logger logger)
Import and synchronize children of the given content In the usual case, if we are in import mode (create to true) or if we trust the source (removalSync to true) we just synchronize structure but we don't synchronize child contentsboolean
handleRightAssignmentContext()
Return true if aRightAssignmentContext
should be automatically generated for the contents of this SCCList<ModifiableContent>
importContent(String idValue, Map<String,Object> additionalParameters, org.slf4j.Logger logger)
Import a content from remote values.protected List<ModifiableContent>
importOrSynchronizeChildren(String idValue, Content content, String sccModelId, String attributeName, boolean create, org.slf4j.Logger logger)
Import and synchronize children of the given content In the usual case, if we are in import mode (create to true) or if we trust the source (removalSync to true) we just synchronize structure but we don't synchronize child contentsList<ModifiableContent>
importOrSynchronizeContents(Map<String,Object> searchParams, org.slf4j.Logger logger)
Method used to import the structure of an ODF content or its dependencies, import or synchronize each child recursively.protected Map<String,Map<String,Object>>
internalSearch(Map<String,Object> searchParameters, int offset, int limit, List<Object> sort, org.slf4j.Logger logger)
Search values and return the result without any treatment.List<ModifiableContent>
populate(org.slf4j.Logger logger)
Populates contentsprotected Map<String,Object>
putIdParameter(String idValue)
Set search parameters for the ID value.void
service(ServiceManager manager)
void
synchronizeContent(ModifiableContent content, org.slf4j.Logger logger)
Synchronize a content with remove values.-
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
_editContent, _fillContent, _getContentsToRemove, _handleContent, _importOrSynchronizeContent, _importOrSynchronizeContent, _importOrSynchronizeContents, _isHandled, _transformRemoteValues, configure, createContentAction, getContent, getTransformedRemoteValues, search, updateSyncInformations, validateContent
-
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_deleteContents, _getAdditionalInputsForContentCreation, _getContentPathQuery, _getExpressionsList, _hasSomethingChanged, _isParamNotEmpty, _logSynchronizationResult, _removeEmptyParameters, createContentAction, deleteUnexistingContents, empty, getSynchronizationResult, sendErrorMail, validateContent
-
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_parseLanguages, _parseParameters, _transformRemoteValuesCardinality, configureStaticParams, getContentPrefix, getContentType, getId, getInitialActionId, getLabel, getParameterValues, getReportMails, getRestrictedField, getSearchModelConfiguration, getSynchronizeActionId, getSynchronizeCollectionModelId, getSynchronizingContentOperator, getValidateActionId, getWorkflowName, 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
-
-
-
-
Field Detail
-
PARAM_DATASOURCE_ID
public static final String PARAM_DATASOURCE_ID
Name of parameter holding the data source id- See Also:
- Constant Field Values
-
PARAM_YEAR
public static final String PARAM_YEAR
Name of parameter holding the administrative year- See Also:
- Constant Field Values
-
PARAM_ADD_UNEXISTING_CHILDREN
public static final String PARAM_ADD_UNEXISTING_CHILDREN
Name of parameter holding the adding unexisting children parameter- See Also:
- Constant Field Values
-
__PARAM_ID_COLUMN
protected static final String __PARAM_ID_COLUMN
Name of parameter holding the field ID column- See Also:
- Constant Field Values
-
__PARAM_MAPPING
protected static final String __PARAM_MAPPING
Name of parameter holding the fields mapping- See Also:
- Constant Field Values
-
__PARAM_MAPPING_SYNCHRO
protected static final String __PARAM_MAPPING_SYNCHRO
Name of parameter into mapping holding the synchronized property- See Also:
- Constant Field Values
-
__PARAM_MAPPING_METADATA_REF
protected static final String __PARAM_MAPPING_METADATA_REF
Name of parameter into mapping holding the path of metadata- See Also:
- Constant Field Values
-
__PARAM_MAPPING_ATTRIBUTE
protected static final String __PARAM_MAPPING_ATTRIBUTE
Name of parameter into mapping holding the remote attribute- See Also:
- Constant Field Values
-
__PARAM_CRITERIA
protected static final String __PARAM_CRITERIA
Name of parameter holding the criteria- See Also:
- Constant Field Values
-
__PARAM_CRITERIA_CRITERION
protected static final String __PARAM_CRITERIA_CRITERION
Name of parameter into criteria holding a criterion- See Also:
- Constant Field Values
-
__PARAM_CRITERIA_CRITERION_ID
protected static final String __PARAM_CRITERIA_CRITERION_ID
Name of parameter into criterion holding the id- See Also:
- Constant Field Values
-
__PARAM_CRITERIA_CRITERION_LABEL
protected static final String __PARAM_CRITERIA_CRITERION_LABEL
Name of parameter into criterion holding the label- See Also:
- Constant Field Values
-
__PARAM_CRITERIA_CRITERION_TYPE
protected static final String __PARAM_CRITERIA_CRITERION_TYPE
Name of parameter into criterion holding the type- See Also:
- Constant Field Values
-
__PARAM_COLUMNS
protected static final String __PARAM_COLUMNS
Name of paramter holding columns- See Also:
- Constant Field Values
-
__PARAM_COLUMNS_COLUMN
protected static final String __PARAM_COLUMNS_COLUMN
Name of paramter into columns holding column- See Also:
- Constant Field Values
-
_syncFields
protected Set<String> _syncFields
Synchronized fields
-
_criteria
protected Set<ApogeeCriterion> _criteria
Synchronized fields
-
_apogeeDAO
protected ApogeeDAO _apogeeDAO
The DAO for remote DB Apogee
-
_jsonUtils
protected JSONUtils _jsonUtils
The JSON utils
-
_sccDAO
protected SynchronizableContentsCollectionDAO _sccDAO
SCC DAO
-
_odfHelper
protected ODFHelper _odfHelper
The ODF helper
-
_apogeeSCCHelper
protected ApogeeSynchronizableContentsCollectionHelper _apogeeSCCHelper
The Apogee SCC helper
-
-
Constructor Detail
-
AbstractApogeeSynchronizableContentsCollection
public AbstractApogeeSynchronizableContentsCollection()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSimpleSynchronizableContentsCollection
- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
configureDataSource
protected void configureDataSource(Configuration configuration) throws ConfigurationException
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
-
populate
public List<ModifiableContent> populate(org.slf4j.Logger logger)
Description copied from interface:SynchronizableContentsCollection
Populates contents- Specified by:
populate
in interfaceSynchronizableContentsCollection
- Overrides:
populate
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
logger
- The logger- Returns:
- Return the populated contents (imported or synchronized)
-
_internalPopulate
protected List<ModifiableContent> _internalPopulate(org.slf4j.Logger logger)
Description copied from class:AbstractSynchronizableContentsCollection
Internal implementation ofAbstractSynchronizableContentsCollection.populate(Logger)
- Overrides:
_internalPopulate
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
logger
- The logger- Returns:
- The list of created/synchronized contents
-
internalSearch
protected Map<String,Map<String,Object>> internalSearch(Map<String,Object> searchParameters, int offset, int limit, List<Object> sort, org.slf4j.Logger logger)
Description copied from class:AbstractSimpleSynchronizableContentsCollection
Search values and return the result without any treatment.- Specified by:
internalSearch
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
searchParameters
- 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.
-
getRemoteValues
protected Map<String,Map<String,List<Object>>> getRemoteValues(Map<String,Object> searchParameters, org.slf4j.Logger logger)
Description copied from class:AbstractSimpleSynchronizableContentsCollection
Search values and return the result organized by attributes- Specified by:
getRemoteValues
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
searchParameters
- Search parameters to restrict the searchlogger
- The logger- Returns:
- Map of results organized by attributes.
-
getLanguages
public List<String> 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
-
importContent
public List<ModifiableContent> importContent(String idValue, Map<String,Object> additionalParameters, org.slf4j.Logger logger) throws Exception
Description 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 importadditionalParameters
- Additional parameterslogger
- The logger- Returns:
- A list of created contents
- Throws:
Exception
- if an error occurs.
-
synchronizeContent
public void synchronizeContent(ModifiableContent content, org.slf4j.Logger logger) throws Exception
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.
-
putIdParameter
protected Map<String,Object> putIdParameter(String idValue)
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
-
_search
protected abstract List<Map<String,Object>> _search(Map<String,Object> searchParameters, org.slf4j.Logger logger)
Search the contents with the search parameters. Use id parameter to search an unique content.- Parameters:
searchParameters
- Search parameterslogger
- The logger- Returns:
- A Map of mapped metadatas extract from Apogée database ordered by content unique Apogée ID
-
_convertBigDecimal
protected List<Map<String,Object>> _convertBigDecimal(List<Map<String,Object>> searchResults)
Convert theBigDecimal
values retrieved from database into long values- Parameters:
searchResults
- The initial search results from database- Returns:
- The converted search results
-
_convertBigDecimal
protected Object _convertBigDecimal(String contentTypeId, String attributeName, Object objectToConvert)
Convert the object in parameter to a long if it's aBigDecimal
, otherwise return the object itself.- Parameters:
contentTypeId
- The content type of the parent contentattributeName
- The metadata nameobjectToConvert
- The object to convert if necessary- Returns:
- The converted object
-
_transformClobToString
protected Object _transformClobToString(Object value, String idValue, org.slf4j.Logger logger)
Transform CLOB value to String value.- Parameters:
value
- The input valueidValue
- The identifier of the programlogger
- The logger- Returns:
- the same value, with CLOB transformed to String.
-
getClobColumns
protected Set<String> getClobColumns()
Get the list of CLOB column's names.- Returns:
- The list of the CLOB column's names to transform to
String
-
_transformListOfMap2MapOfList
protected Map<String,List<Object>> _transformListOfMap2MapOfList(List<Map<String,Object>> lines)
-
getMappingName
protected abstract String getMappingName()
Get the name of the mapping.- Returns:
- the mapping name
-
getDataSourceId
protected String getDataSourceId()
Get the id of data source- Returns:
- The id of data source
-
addUnexistingChildren
protected boolean addUnexistingChildren()
Check if unexisting contents in Ametys should be added from data source- Returns:
true
if unexisting contents in Ametys should be added from data source, default value isfalse
-
getIdColumn
protected String getIdColumn()
Get the identifier column (can be a concatened column).- Returns:
- the column id
-
getIdField
public String getIdField()
Description copied from interface:SynchronizableContentsCollection
Get the path of metadata holding the unique identifier- Specified by:
getIdField
in interfaceSynchronizableContentsCollection
- Returns:
- the path to the metadata. Can be null.
-
getLocalAndExternalFields
public Set<String> getLocalAndExternalFields(Map<String,Object> additionalParameters)
Description copied from interface:SynchronizableContentsCollection
Get the path of tri-state fields (with local and external values)- Specified by:
getLocalAndExternalFields
in interfaceSynchronizableContentsCollection
- Parameters:
additionalParameters
- Additional parameters- Returns:
- the synchronized fields
-
getRichTextFields
protected Set<String> getRichTextFields()
Get the list of rich text fields of the imported content.- Returns:
- The list of the rich text fields metadata name
-
configureSearchModel
protected void configureSearchModel()
Description copied from class:AbstractStaticSynchronizableContentsCollection
Configure the search model used by SCCSearchTool.- Specified by:
configureSearchModel
in classAbstractStaticSynchronizableContentsCollection
-
getAdditionalAttributeValues
protected Map<String,Object> getAdditionalAttributeValues(String idValue, Content content, Map<String,Object> additionalParameters, boolean create, org.slf4j.Logger logger)
Description copied from class:AbstractSimpleSynchronizableContentsCollection
Retrieves additional values to synchronize for a content- Overrides:
getAdditionalAttributeValues
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
idValue
- id value of the contentcontent
- The contentadditionalParameters
- Additional parameterscreate
-true
if the content has been newly created,false
otherwiselogger
- The logger- Returns:
- the values to add
-
getParentAttribute
protected Pair<String,Object> getParentAttribute(ModifiableContent parent)
Retrieves the attribute to synchronize for the given parent (as aPair
of name and value)- Parameters:
parent
- the parent content- Returns:
- the parent attribute
-
handleChildren
protected List<ModifiableContent> handleChildren(String idValue, Content content, boolean create, org.slf4j.Logger logger)
Import and synchronize children of the given content In the usual case, if we are in import mode (create to true) or if we trust the source (removalSync to true) we just synchronize structure but we don't synchronize child contents- Parameters:
idValue
- The current content synchronization codecontent
- The current contentcreate
-true
if the content has been newly createdlogger
- The logger- Returns:
- The handled children
-
getNotSynchronizedRelatedContentIds
protected Set<String> getNotSynchronizedRelatedContentIds(Content content, Map<String,Object> contentValues, Map<String,Object> additionalParameters, String lang, org.slf4j.Logger logger)
Description copied from class:AbstractSimpleSynchronizableContentsCollection
Retrieves the ids of the contents related to the given content but that are not part of the synchronization- Overrides:
getNotSynchronizedRelatedContentIds
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
content
- contentcontentValues
- the content values that will be setadditionalParameters
- Additional parameterslang
- Language of the contentlogger
- The logger- Returns:
- the ids of the contents that are not part of the synchronization
-
getParentFromAdditionalParameters
protected Optional<ModifiableContent> getParentFromAdditionalParameters(Map<String,Object> additionalParameters)
Retrieves the parent id, extracted from additional parameters- Parameters:
additionalParameters
- the additional parameters- Returns:
- the parent id
-
getParentIdFromAdditionalParameters
protected Optional<String> getParentIdFromAdditionalParameters(Map<String,Object> additionalParameters)
Retrieves the parent id, extracted from additional parameters- Parameters:
additionalParameters
- the additional parameters- Returns:
- the parent id
-
getChildrenSCCModelId
protected String getChildrenSCCModelId()
Get the children SCC model id. Can be null if no implementation is defined.- Returns:
- the children SCC model id
-
getChildrenAttributeName
protected abstract String getChildrenAttributeName()
Get the attribute name to get children- Returns:
- the attribute name to get children
-
_getSort
protected String _getSort(List<Object> sortList)
- Parameters:
sortList
- The sort list object to transform to the list of ordered fields compatible with SQL.- Returns:
- A string representing the list of ordered fields
-
getTotalCount
public int getTotalCount(Map<String,Object> searchParameters, org.slf4j.Logger logger)
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
-
_importContent
protected ModifiableContent _importContent(String idValue, Map<String,Object> additionalParameters, String lang, Map<String,List<Object>> remoteValues, org.slf4j.Logger logger) throws Exception
Description copied from class:AbstractSimpleSynchronizableContentsCollection
Import a content from remote values.- Overrides:
_importContent
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
idValue
- Id (for import/synchronization) of the content to importadditionalParameters
- Specific parameters for importlang
- Lang of the contentremoteValues
- Values of the contentlogger
- The logger- Returns:
- The content created by import, or null
- Throws:
Exception
- if an error occurs.
-
_synchronizeContent
protected ModifiableContent _synchronizeContent(ModifiableContent content, Map<String,List<Object>> remoteValues, org.slf4j.Logger logger) throws Exception
Description 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
-
importOrSynchronizeChildren
protected List<ModifiableContent> importOrSynchronizeChildren(String idValue, Content content, String sccModelId, String attributeName, boolean create, org.slf4j.Logger logger)
Import and synchronize children of the given content In the usual case, if we are in import mode (create to true) or if we trust the source (removalSync to true) we just synchronize structure but we don't synchronize child contents- Parameters:
idValue
- The parent content synchronization codecontent
- The parent contentsccModelId
- SCC model IDattributeName
- The name of the attribute containing childrencreate
-true
if the content has been newly createdlogger
- The logger- Returns:
- The imported or synchronized children
-
_importChildren
protected List<ModifiableContent> _importChildren(String idValue, SynchronizableContentsCollection scc, org.slf4j.Logger logger)
Import children- Parameters:
idValue
- The parent content synchronization codescc
- The SCClogger
- The logger- Returns:
- The imported children
-
_synchronizeChildren
protected List<ModifiableContent> _synchronizeChildren(Content content, SynchronizableContentsCollection scc, String attributeName, org.slf4j.Logger logger)
Synchronize children- Parameters:
content
- Parent contentscc
- The SCCattributeName
- The name of the attribute containing childrenlogger
- The logger- Returns:
true
if there are changes
-
_getChildrenRemoteSyncCode
protected Set<String> _getChildrenRemoteSyncCode(Content content, SynchronizableContentsCollection scc, org.slf4j.Logger logger)
Get the remote sync codes- Parameters:
content
- Parent contentscc
- the scclogger
- The logger- Returns:
- the remote sync codes or null if the scc is not from Apogee
-
_addUnexistingChildren
protected List<ModifiableContent> _addUnexistingChildren(SynchronizableContentsCollection scc, Set<String> childrenRemoteSyncCode, org.slf4j.Logger logger)
Add unexisting children in Ametys from Apogee- Parameters:
scc
- the scc to import contentschildrenRemoteSyncCode
- the remote sync codeslogger
- the logger- Returns:
- the list of unexisting contents
-
_importUnexistingChildren
protected Stream<ModifiableContent> _importUnexistingChildren(SynchronizableContentsCollection scc, String syncCode, Map<String,List<Object>> additionalParameters, org.slf4j.Logger logger)
Import an unexisting child in Ametys- Parameters:
scc
- the scc to import the contentsyncCode
- the sync code of the contentadditionalParameters
- the additional paramslogger
- the logger- Returns:
- the list of created children
-
_isChildWillBeRemoved
protected boolean _isChildWillBeRemoved(ModifiableContent content, SynchronizableContentsCollection scc, Set<String> childrenRemoteSyncCode, org.slf4j.Logger logger)
True if the content will be removed from the structure- Parameters:
content
- the contentscc
- the sccchildrenRemoteSyncCode
- the remote sync codeslogger
- the logger- Returns:
true
if the content will be removed from the structure
-
importOrSynchronizeContents
public List<ModifiableContent> importOrSynchronizeContents(Map<String,Object> searchParams, org.slf4j.Logger logger)
Description copied from interface:ApogeeSynchronizableContentsCollection
Method used to import the structure of an ODF content or its dependencies, import or synchronize each child recursively.- Specified by:
importOrSynchronizeContents
in interfaceApogeeSynchronizableContentsCollection
- Parameters:
searchParams
- Search parameterslogger
- The logger- Returns:
- The
List
ofModifiableContent
of children (imported or synchronized)
-
handleRightAssignmentContext
public boolean handleRightAssignmentContext()
Description copied from interface:SynchronizableContentsCollection
Return true if aRightAssignmentContext
should be automatically generated for the contents of this SCC- Specified by:
handleRightAssignmentContext
in interfaceSynchronizableContentsCollection
- Returns:
- true to automatically generate a
RightAssignmentContext
. Return false if the rights of contents of this SCC are handle by its ownRightAssignmentContext
-
-