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 Set<String>
_columns
Synchronized fieldsprotected Context
_context
Contextprotected Set<ApogeeCriterion>
_criteria
Synchronized fieldsprotected Set<String>
_extFields
External 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 String
_odfLang
Default language configured for ODFprotected SynchronizableContentsCollectionDAO
_sccDAO
SCC DAOprotected Set<String>
_syncFields
Synchronized fieldsstatic String
HANDLE_CONTENTS
Request attribute name to store handle contents during import or synchronization.static 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, _sccHelper, _synchronizingContentOperatorEP
-
Fields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_contentDAO, _contentTypeEP, _currentUserProvider, _hasGlobalError, _i18nUtils, _nbCreatedContents, _nbDeletedContents, _nbError, _nbNotChangedContents, _nbSynchronizedContents, _observationManager, _resolver, _synchroComponent, SCC_UNIQUE_ID
-
Fields inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_contentPrefix, _contentType, _id, _initialActionId, _label, _languages, _modelId, _modelParamValues, _removalSync, _reportMails, _restrictedField, _searchModelConfiguration, _synchronizeActionId, _synchronizeExistingContentsOnly, _synchronizingContentOperator, _validateActionId, _validateAfterImport, _workflowName
-
Fields inherited from interface org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollection
COLLECTION_ID_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description AbstractApogeeSynchronizableContentsCollection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.protected List<Map<String,Object>>
_convertBigDecimal(List<Map<String,Object>> searchResults)
Convert theBigDecimal
values retrieved from database into long valuesprotected boolean
_fillContent(Map<String,List<Object>> remoteValues, ModifiableDefaultContent content, boolean create, org.slf4j.Logger logger)
Fill the content with remote values.protected boolean
_fillRichTexts(Map<String,List<Object>> remoteValues, ModifiableDefaultContent content, boolean create, org.slf4j.Logger logger)
Fill the richt texts of the content with the remote values.protected Optional<AbstractApogeeSynchronizableContentsCollection>
_getContentSCC(DefaultContent content, org.slf4j.Logger logger)
Get the Apogee SCC for the content if it existsprivate I18nizableText
_getCriterionLabel(Configuration configuration, String defaultValue)
protected String
_getSort(List<Object> sortList)
protected boolean
_handleAdditionalMetadata(ModifiableCompositeMetadata holder, boolean create)
Method to add additional metadata on import or synchronize.protected ModifiableDefaultContent
_importContent(String idValue, Map<String,Object> importParams, String lang, Map<String,List<Object>> remoteValues, org.slf4j.Logger logger)
Import a content from remote values.protected List<ModifiableDefaultContent>
_importOrSynchronizeContent(String idValue, Map<String,List<Object>> remoteValues, boolean forceImport, org.slf4j.Logger logger)
Imports or synchronizes a content for each available languageprotected List<ModifiableDefaultContent>
_importOrSynchronizeContents(Map<String,Object> searchParams, boolean forceImport, org.slf4j.Logger logger)
Import or synchronize several contents from search params.protected boolean
_resetChildren(ModifiableDefaultContent content, String sccModelId, String metadataName, String invertMetadataName, org.slf4j.Logger logger)
Reset the children of the structure to force with the children from Apogée.protected abstract List<Map<String,Object>>
_search(Map<String,Object> searchParams, org.slf4j.Logger logger)
Search the contents with the search parameters.protected void
_setRichTextValue(ModifiableRichText richText, List<Object> remoteValue)
Set the value on the rich text.protected ModifiableDefaultContent
_synchronizeContent(ModifiableDefaultContent 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.private Map<String,List<Object>>
_transformOrgUnitMetadata(Map<String,List<Object>> remoteValues, org.slf4j.Logger logger)
protected boolean
additionalCommonOperations(ModifiableDefaultContent content, Map<String,List<Object>> remoteValues, Map<String,Object> importParams, boolean create, org.slf4j.Logger logger)
Add specific fields to the content during import or synchronization.protected boolean
addToHandleContents(String contentId)
Add the content ID to the handle contents list.protected void
configureDataSource(Configuration configuration)
Configure the data source parameters.protected void
configureSearchModel()
Configure the search model used by SCCSearchTool.void
contextualize(Context context)
protected String
getDataSourceId()
Get the id of data sourceSet<String>
getExternalOnlyFields(Map<String,Object> additionalParameters)
Get the path of field that are valued externally only.protected String
getIdColumn()
Get the identifier column (can be a concatened column).String
getIdField()
Get the path of metadata holding the unique identifierSet<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 Map<String,Map<String,List<Object>>>
getRemoteValues(Map<String,Object> parameters, org.slf4j.Logger logger)
Search values and return the result organized by metadataprotected Set<String>
getRichTextFields()
Get the list of rich text fields of the imported content.int
getTotalCount(Map<String,Object> parameters, org.slf4j.Logger logger)
Return the total number of results for the search.protected String
getYear()
Get the administrative yearprotected boolean
handleChildren(ModifiableDefaultContent content, boolean create, org.slf4j.Logger logger)
Set the children metadata and invert relation, import and synchronize the children too.protected boolean
handleParent(ModifiableDefaultContent currentContent, ModifiableDefaultContent parentContent, org.slf4j.Logger logger)
Set the parent metadata and invert relation.boolean
handleRightAssignmentContext()
Return true if aRightAssignmentContext
should be automatically generated for the contents of this SCCList<ModifiableDefaultContent>
importContent(String idValue, Map<String,Object> importParams, org.slf4j.Logger logger)
Import a content from remote values.protected boolean
importOrSynchronizeChildren(ModifiableDefaultContent content, String sccModelId, String metadataName, String invertMetadataName, boolean create, org.slf4j.Logger logger)
Import and synchronize children of the given content, then edit the structure of the content and its children.List<ModifiableDefaultContent>
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> parameters, int offset, int limit, List<Object> sort, org.slf4j.Logger logger)
Search values and return the result without any treatment.List<ModifiableDefaultContent>
populate(org.slf4j.Logger logger)
Populates contentsprotected Map<String,Object>
putIdParameter(String idValue)
Set search parameters for the ID value.void
service(ServiceManager manager)
protected boolean
setAdditionalMetadata(ModifiableDefaultContent content, Map<String,List<Object>> remoteValues, boolean create, org.slf4j.Logger logger)
Set the additional metadata.void
synchronizeContent(ModifiableDefaultContent content, org.slf4j.Logger logger)
Synchronize a content with remove values.-
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
_getContentsToRemove, _getIdFieldValue, _handleContent, _importOrSynchronizeContent, _internalPopulate, _isHandled, additionalImportOperations, additionalSynchronizeOperations, configure, createContentAction, getContent, getTransformedRemoteValues, search, updateSyncInformations, validateContent
-
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_getContentPathQuery, _getExpressionsList, _getMetadataHolder, _isParamNotEmpty, _removeEmptyParameters, _removeMetadataIfExists, _synchronizeMetadata, _updateRelation, _updateRelation, applyChanges, applyChanges, createContentAction, deleteUnexistingContents, sendErrorMail, updateSCCProperty, validateContent
-
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_parseLanguages, _parseParameters, configureStaticParams, getContentPrefix, getContentType, getId, getInitialActionId, getLabel, getLanguages, getParameterValues, getReportMails, getRestrictedField, getSearchModelConfiguration, getSynchronizeActionId, getSynchronizeCollectionModelId, getSynchronizingContentOperator, getValidateActionId, getWorkflowName, removalSync, synchronizeExistingContentsOnly, validateAfterImport
-
-
-
-
Field Detail
-
HANDLE_CONTENTS
public static final String HANDLE_CONTENTS
Request attribute name to store handle contents during import or synchronization.
-
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_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
-
_extFields
protected Set<String> _extFields
External fields
-
_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
-
-
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
-
_getCriterionLabel
private I18nizableText _getCriterionLabel(Configuration configuration, String defaultValue)
-
populate
public List<ModifiableDefaultContent> 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)
-
internalSearch
protected Map<String,Map<String,Object>> internalSearch(Map<String,Object> parameters, 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:
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.
-
getRemoteValues
protected Map<String,Map<String,List<Object>>> getRemoteValues(Map<String,Object> parameters, org.slf4j.Logger logger)
Description copied from class:AbstractSimpleSynchronizableContentsCollection
Search values and return the result organized by metadata- Specified by:
getRemoteValues
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
parameters
- Search parameters to restrict the searchlogger
- The logger- Returns:
- Map of results organized by metadata.
-
_importOrSynchronizeContent
protected List<ModifiableDefaultContent> _importOrSynchronizeContent(String idValue, Map<String,List<Object>> remoteValues, boolean forceImport, org.slf4j.Logger logger)
Description copied from class:AbstractSimpleSynchronizableContentsCollection
Imports or synchronizes a content for each available language- Overrides:
_importOrSynchronizeContent
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
idValue
- The unique identifier of the contentremoteValues
- The remote valuesforceImport
- To force import and ignoring the synchronize existing contents only optionlogger
- The logger- Returns:
- The list of synchronized or imported contents
-
importContent
public List<ModifiableDefaultContent> importContent(String idValue, Map<String,Object> importParams, 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 importimportParams
- Additional parameterslogger
- The logger- Returns:
- A list of created contents
- Throws:
Exception
- if an error occurs.
-
synchronizeContent
public void synchronizeContent(ModifiableDefaultContent 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> searchParams, org.slf4j.Logger logger)
Search the contents with the search parameters. Use id parameter to search an unique content.- Parameters:
searchParams
- 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.
-
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
-
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
-
getExternalOnlyFields
public Set<String> getExternalOnlyFields(Map<String,Object> additionalParameters)
Description copied from interface:SynchronizableContentsCollection
Get the path of field that are valued externally only.- Specified by:
getExternalOnlyFields
in interfaceSynchronizableContentsCollection
- Parameters:
additionalParameters
- Additional parameters- Returns:
- the external fields
-
_fillContent
protected boolean _fillContent(Map<String,List<Object>> remoteValues, ModifiableDefaultContent content, boolean create, org.slf4j.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 synchronizecreate
-true
if content is creating, false if it is updatedlogger
- The logger- Returns:
true
if changes were made
-
_fillRichTexts
protected boolean _fillRichTexts(Map<String,List<Object>> remoteValues, ModifiableDefaultContent content, boolean create, org.slf4j.Logger logger)
Fill the richt texts of the content with the remote values.- Parameters:
remoteValues
- The remote valuescontent
- The content to synchronizecreate
-true
if content is creating, false if it is updatedlogger
- The logger- Returns:
true
if changes were made
-
_setRichTextValue
protected void _setRichTextValue(ModifiableRichText richText, List<Object> remoteValue) throws IOException
Set the value on the rich text.- Parameters:
richText
- The rich text to updateremoteValue
- The remote value of the rich text (can be composed of several texts to concatenate)- Throws:
IOException
- if an exception occurs
-
_handleAdditionalMetadata
protected boolean _handleAdditionalMetadata(ModifiableCompositeMetadata holder, boolean create)
Method to add additional metadata on import or synchronize.- Parameters:
holder
- The holder of the content to updatecreate
- If we are on creation mode- Returns:
true
if changes has been made
-
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
-
additionalCommonOperations
protected boolean additionalCommonOperations(ModifiableDefaultContent content, Map<String,List<Object>> remoteValues, Map<String,Object> importParams, boolean create, org.slf4j.Logger logger)
Description copied from class:AbstractSimpleSynchronizableContentsCollection
Add specific fields to the content during import or synchronization.- Overrides:
additionalCommonOperations
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
content
- Content to updateremoteValues
- Values of the contentimportParams
- the import paramscreate
- true if the content has been newly createdlogger
- The logger- Returns:
true
if there are changes
-
handleParent
protected boolean handleParent(ModifiableDefaultContent currentContent, ModifiableDefaultContent parentContent, org.slf4j.Logger logger)
Set the parent metadata and invert relation.- Parameters:
currentContent
- Current contentparentContent
- Parent content to setlogger
- The logger- Returns:
true
if there are changes
-
handleChildren
protected boolean handleChildren(ModifiableDefaultContent content, boolean create, org.slf4j.Logger logger)
Set the children metadata and invert relation, import and synchronize the children too.- Parameters:
content
- Current contentcreate
- true if the content has been newly createdlogger
- The logger- Returns:
true
if there are changes
-
setAdditionalMetadata
protected boolean setAdditionalMetadata(ModifiableDefaultContent content, Map<String,List<Object>> remoteValues, boolean create, org.slf4j.Logger logger)
Set the additional metadata.- Parameters:
content
- Current contentremoteValues
- Values of the contentcreate
- true if the content has been newly createdlogger
- The logger- Returns:
true
if there are changes
-
_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> parameters, 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:
parameters
- Parameters for the searchlogger
- The logger- Returns:
- The total count
-
_importContent
protected ModifiableDefaultContent _importContent(String idValue, Map<String,Object> importParams, 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 importimportParams
- 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 ModifiableDefaultContent _synchronizeContent(ModifiableDefaultContent 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.
-
_importOrSynchronizeContents
protected List<ModifiableDefaultContent> _importOrSynchronizeContents(Map<String,Object> searchParams, boolean forceImport, org.slf4j.Logger logger)
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 logger- Returns:
- The
List
of imported or synchronizedModifiableDefaultContent
-
importOrSynchronizeChildren
protected boolean importOrSynchronizeChildren(ModifiableDefaultContent content, String sccModelId, String metadataName, String invertMetadataName, boolean create, org.slf4j.Logger logger)
Import and synchronize children of the given content, then edit the structure of the content and its children. 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:
content
- Parent contentsccModelId
- SCC model IDmetadataName
- Metadata name to setinvertMetadataName
- Metadata name of the invert relationcreate
- true if the content has been newly createdlogger
- The logger- Returns:
true
if there are changes
-
_resetChildren
protected boolean _resetChildren(ModifiableDefaultContent content, String sccModelId, String metadataName, String invertMetadataName, org.slf4j.Logger logger)
Reset the children of the structure to force with the children from Apogée.- Parameters:
content
- Parent contentsccModelId
- SCC model IDmetadataName
- Metadata name to setinvertMetadataName
- Metadata name of the invert relationlogger
- The logger- Returns:
true
if there are changes
-
_getContentSCC
protected Optional<AbstractApogeeSynchronizableContentsCollection> _getContentSCC(DefaultContent content, org.slf4j.Logger logger)
Get the Apogee SCC for the content if it exists- Parameters:
content
- The content to search onlogger
- The logger- Returns:
- the Apogee SCC
-
importOrSynchronizeContents
public List<ModifiableDefaultContent> 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
ofModifiableDefaultContent
of children (imported or synchronized)
-
addToHandleContents
protected boolean addToHandleContents(String contentId)
Add the content ID to the handle contents list.- Parameters:
contentId
- Content ID- Returns:
true
if the content ID have been added,false
is returned if the content ID already exists in the handle contents list.
-
_transformOrgUnitMetadata
private Map<String,List<Object>> _transformOrgUnitMetadata(Map<String,List<Object>> remoteValues, org.slf4j.Logger logger)
-
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
-
-