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_COLUMNSName of paramter holding columnsprotected static String__PARAM_COLUMNS_COLUMNName of paramter into columns holding columnprotected static String__PARAM_CRITERIAName of parameter holding the criteriaprotected static String__PARAM_CRITERIA_CRITERIONName of parameter into criteria holding a criterionprotected static String__PARAM_CRITERIA_CRITERION_IDName of parameter into criterion holding the idprotected static String__PARAM_CRITERIA_CRITERION_LABELName of parameter into criterion holding the labelprotected static String__PARAM_CRITERIA_CRITERION_TYPEName of parameter into criterion holding the typeprotected static String__PARAM_ID_COLUMNName of parameter holding the field ID columnprotected static String__PARAM_MAPPINGName of parameter holding the fields mappingprotected static String__PARAM_MAPPING_ATTRIBUTEName of parameter into mapping holding the remote attributeprotected static String__PARAM_MAPPING_METADATA_REFName of parameter into mapping holding the path of metadataprotected static String__PARAM_MAPPING_SYNCHROName of parameter into mapping holding the synchronized propertyprotected ApogeeDAO_apogeeDAOThe DAO for remote DB Apogeeprotected ApogeeSynchronizableContentsCollectionHelper_apogeeSCCHelperThe Apogee SCC helperprotected Set<String>_columnsSynchronized fieldsprotected Context_contextContextprotected Set<ApogeeCriterion>_criteriaSynchronized fieldsprotected Set<String>_extFieldsExternal fieldsprotected String_idColumnName of the Apogée column which contains the IDprotected JSONUtils_jsonUtilsThe JSON utilsprotected Map<String,List<String>>_mappingMapping between metadata and columnsprotected ODFHelper_odfHelperThe ODF helperprotected String_odfLangDefault language configured for ODFprotected SynchronizableContentsCollectionDAO_sccDAOSCC DAOprotected Set<String>_syncFieldsSynchronized fieldsstatic StringPARAM_ADD_UNEXISTING_CHILDRENName of parameter holding the adding unexisting children parameterstatic StringPARAM_DATASOURCE_IDName of parameter holding the data source idstatic StringPARAM_YEARName 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
_contentTypeEP, _currentUserProvider, _hasGlobalError, _i18nUtils, _nbCreatedContents, _nbDeletedContents, _nbError, _nbNotChangedContents, _nbSynchronizedContents, _observationManager, _synchroComponent, SCC_UNIQUE_ID
-
Fields inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_contentDAO, _contentPrefix, _contentType, _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_PROPERTY
-
-
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 theBigDecimalvalues 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 Set<String>_getChildrenRemoteSyncCode(ModifiableDefaultContent content, SynchronizableContentsCollection scc, org.slf4j.Logger logger)Get the remote sync codesprivate 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 boolean_importChildren(ModifiableDefaultContent content, SynchronizableContentsCollection scc, String metadataName, String invertMetadataName, org.slf4j.Logger logger)Import childrenprotected 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 Stream<ModifiableDefaultContent>_importUnexistingChildren(SynchronizableContentsCollection scc, String syncCode, Map<String,List<Object>> params, org.slf4j.Logger logger)Import an unexisting child in Ametysprotected List<ModifiableDefaultContent>_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 boolean_resetChildren(ModifiableDefaultContent content, List<? extends ModifiableContent> importedOrSynchronizedChildren, 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 boolean_synchronizeChildren(ModifiableDefaultContent content, SynchronizableContentsCollection scc, String metadataName, String invertMetadataName, org.slf4j.Logger logger)Synchronize childrenprotected 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.protected Map<String,List<Object>>_transformListOfMap2MapOfList(List<Map<String,Object>> lines)private Map<String,List<Object>>_transformOrgUnitMetadata(Map<String,List<Object>> remoteValues, org.slf4j.Logger logger)protected booleanadditionalCommonOperations(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 booleanaddUnexistingChildren()Check if unexisting contents in Ametys should be added from data sourceprotected voidconfigureDataSource(Configuration configuration)Configure the data source parameters.protected voidconfigureSearchModel()Configure the search model used by SCCSearchTool.voidcontextualize(Context context)protected abstract StringgetChildrenInvertMetadataName()Get the metadata name to get parent from childrenprotected abstract StringgetChildrenMetadataName()Get the metadata name to get childrenprotected StringgetChildrenSCCModelId()Get the children SCC model id.protected Set<String>getClobColumns()Get the list of CLOB column's names.protected StringgetDataSourceId()Get the id of data sourceSet<String>getExternalOnlyFields(Map<String,Object> additionalParameters)Get the path of field that are valued externally only.protected StringgetIdColumn()Get the identifier column (can be a concatened column).StringgetIdField()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 StringgetMappingName()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.intgetTotalCount(Map<String,Object> parameters, org.slf4j.Logger logger)Return the total number of results for the search.protected StringgetYear()Get the administrative yearprotected booleanhandleChildren(ModifiableDefaultContent content, boolean create, org.slf4j.Logger logger)Set the children metadata and invert relation, import and synchronize the children too.protected booleanhandleParent(ModifiableDefaultContent currentContent, ModifiableDefaultContent parentContent, org.slf4j.Logger logger)Set the parent metadata and invert relation.booleanhandleRightAssignmentContext()Return true if aRightAssignmentContextshould 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 booleanimportOrSynchronizeChildren(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.voidservice(ServiceManager manager)protected booleansetAdditionalMetadata(ModifiableDefaultContent content, Map<String,List<Object>> remoteValues, boolean create, org.slf4j.Logger logger)Set the additional metadata.voidsynchronizeContent(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, _importOrSynchronizeContents, _isHandled, additionalImportOperations, additionalSynchronizeOperations, configure, createContentAction, getContent, getTransformedRemoteValues, search, updateSyncInformations, validateContent
-
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_deleteContents, _getContentPathQuery, _getExpressionsList, _getMetadataHolder, _isParamNotEmpty, _removeEmptyParameters, _removeMetadataIfExists, _synchronizeMetadata, _updateRelation, _updateRelation, applyChanges, applyChanges, createContentAction, deleteUnexistingContents, empty, 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
-
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
-
_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
-
_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:
servicein interfaceServiceable- Overrides:
servicein classAbstractSimpleSynchronizableContentsCollection- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
configureDataSource
protected void configureDataSource(Configuration configuration) throws ConfigurationException
Description copied from class:AbstractStaticSynchronizableContentsCollectionConfigure the data source parameters.- Specified by:
configureDataSourcein 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:SynchronizableContentsCollectionPopulates contents- Specified by:
populatein interfaceSynchronizableContentsCollection- Overrides:
populatein classAbstractSimpleSynchronizableContentsCollection- Parameters:
logger- The logger- Returns:
- Return the populated contents (imported or synchronized)
-
_internalPopulate
protected List<ModifiableDefaultContent> _internalPopulate(org.slf4j.Logger logger)
Description copied from class:AbstractSynchronizableContentsCollectionInternal implementation ofAbstractSynchronizableContentsCollection.populate(Logger)- Overrides:
_internalPopulatein classAbstractSimpleSynchronizableContentsCollection- Parameters:
logger- The logger- Returns:
- The list of created/synchronized contents
-
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: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.
-
getRemoteValues
protected Map<String,Map<String,List<Object>>> getRemoteValues(Map<String,Object> parameters, org.slf4j.Logger logger)
Description copied from class:AbstractSimpleSynchronizableContentsCollectionSearch values and return the result organized by metadata- Specified by:
getRemoteValuesin 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:AbstractSimpleSynchronizableContentsCollectionImports or synchronizes a content for each available language- Overrides:
_importOrSynchronizeContentin 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: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
public void synchronizeContent(ModifiableDefaultContent content, org.slf4j.Logger logger) throws Exception
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.
-
putIdParameter
protected Map<String,Object> putIdParameter(String idValue)
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
-
_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 theBigDecimalvalues 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:
trueif 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:SynchronizableContentsCollectionGet the path of metadata holding the unique identifier- Specified by:
getIdFieldin interfaceSynchronizableContentsCollection- Returns:
- the path to the metadata. Can be null.
-
getLocalAndExternalFields
public Set<String> getLocalAndExternalFields(Map<String,Object> additionalParameters)
Description copied from interface:SynchronizableContentsCollectionGet the path of tri-state fields (with local and external values)- Specified by:
getLocalAndExternalFieldsin interfaceSynchronizableContentsCollection- Parameters:
additionalParameters- Additional parameters- Returns:
- the synchronized fields
-
getExternalOnlyFields
public Set<String> getExternalOnlyFields(Map<String,Object> additionalParameters)
Description copied from interface:SynchronizableContentsCollectionGet the path of field that are valued externally only.- Specified by:
getExternalOnlyFieldsin 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:AbstractSimpleSynchronizableContentsCollectionFill the content with remote values.- Overrides:
_fillContentin classAbstractSimpleSynchronizableContentsCollection- Parameters:
remoteValues- The remote valuescontent- The content to synchronizecreate-trueif content is creating, false if it is updatedlogger- The logger- Returns:
trueif 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-trueif content is creating, false if it is updatedlogger- The logger- Returns:
trueif 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:
trueif 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:AbstractStaticSynchronizableContentsCollectionConfigure the search model used by SCCSearchTool.- Specified by:
configureSearchModelin 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:AbstractSimpleSynchronizableContentsCollectionAdd specific fields to the content during import or synchronization.- Overrides:
additionalCommonOperationsin classAbstractSimpleSynchronizableContentsCollection- Parameters:
content- Content to updateremoteValues- Values of the contentimportParams- the import paramscreate- true if the content has been newly createdlogger- The logger- Returns:
trueif 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:
trueif 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:
trueif there are changes
-
getChildrenSCCModelId
protected String getChildrenSCCModelId()
Get the children SCC model id. Can be null if no implementation is defined.- Returns:
- the children SCC model id
-
getChildrenMetadataName
protected abstract String getChildrenMetadataName()
Get the metadata name to get children- Returns:
- the metadata name to get children
-
getChildrenInvertMetadataName
protected abstract String getChildrenInvertMetadataName()
Get the metadata name to get parent from children- Returns:
- the metadata name to get parent from children
-
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:
trueif 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:SynchronizableContentsCollectionReturn the total number of results for the search.- Specified by:
getTotalCountin interfaceSynchronizableContentsCollection- Overrides:
getTotalCountin 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:AbstractSimpleSynchronizableContentsCollectionImport a content from remote values.- Overrides:
_importContentin 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: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.
-
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:
trueif there are changes
-
_importChildren
protected boolean _importChildren(ModifiableDefaultContent content, SynchronizableContentsCollection scc, String metadataName, String invertMetadataName, org.slf4j.Logger logger)
Import children- Parameters:
content- Parent contentscc- the sccmetadataName- Metadata name to setinvertMetadataName- Metadata name of the invert relationlogger- The logger- Returns:
trueif there are changes
-
_synchronizeChildren
protected boolean _synchronizeChildren(ModifiableDefaultContent content, SynchronizableContentsCollection scc, String metadataName, String invertMetadataName, org.slf4j.Logger logger)
Synchronize children- Parameters:
content- Parent contentscc- the sccmetadataName- Metadata name to setinvertMetadataName- Metadata name of the invert relationlogger- The logger- Returns:
trueif there are changes
-
_getChildrenRemoteSyncCode
protected Set<String> _getChildrenRemoteSyncCode(ModifiableDefaultContent 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<ModifiableDefaultContent> _importUnexistingChildren(SynchronizableContentsCollection scc, String syncCode, Map<String,List<Object>> params, org.slf4j.Logger logger)
Import an unexisting child in Ametys- Parameters:
scc- the scc to import the contentsyncCode- the sync code of the contentparams- 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:
trueif the content will be removed from the structure
-
_resetChildren
protected boolean _resetChildren(ModifiableDefaultContent content, List<? extends ModifiableContent> importedOrSynchronizedChildren, 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 contentimportedOrSynchronizedChildren- the imported or synchronized childrenmetadataName- Metadata name to setinvertMetadataName- Metadata name of the invert relationlogger- The logger- Returns:
trueif there are changes
-
importOrSynchronizeContents
public List<ModifiableDefaultContent> importOrSynchronizeContents(Map<String,Object> searchParams, org.slf4j.Logger logger)
Description copied from interface:ApogeeSynchronizableContentsCollectionMethod used to import the structure of an ODF content or its dependencies, import or synchronize each child recursively.- Specified by:
importOrSynchronizeContentsin interfaceApogeeSynchronizableContentsCollection- Parameters:
searchParams- Search parameterslogger- The logger- Returns:
- The
ListofModifiableDefaultContentof children (imported or synchronized)
-
_transformOrgUnitMetadata
private Map<String,List<Object>> _transformOrgUnitMetadata(Map<String,List<Object>> remoteValues, org.slf4j.Logger logger)
-
handleRightAssignmentContext
public boolean handleRightAssignmentContext()
Description copied from interface:SynchronizableContentsCollectionReturn true if aRightAssignmentContextshould be automatically generated for the contents of this SCC- Specified by:
handleRightAssignmentContextin interfaceSynchronizableContentsCollection- Returns:
- true to automatically generate a
RightAssignmentContext. Return false if the rights of contents of this SCC are handle by its ownRightAssignmentContext
-
-