public abstract class AbstractApogeeSynchronizableContentsCollection extends AbstractSimpleSynchronizableContentsCollection implements Contextualizable, ApogeeSynchronizableContentsCollection
Modifier and Type | Field and Description |
---|---|
protected static String |
__PARAM_COLUMNS
Name of paramter holding columns
|
protected static String |
__PARAM_COLUMNS_COLUMN
Name of paramter into columns holding column
|
protected static String |
__PARAM_CRITERIA
Name of parameter holding the criteria
|
protected static String |
__PARAM_CRITERIA_CRITERION
Name of parameter into criteria holding a criterion
|
protected static String |
__PARAM_CRITERIA_CRITERION_ID
Name of parameter into criterion holding the id
|
protected static String |
__PARAM_CRITERIA_CRITERION_LABEL
Name of parameter into criterion holding the label
|
protected static String |
__PARAM_CRITERIA_CRITERION_TYPE
Name of parameter into criterion holding the type
|
protected static String |
__PARAM_ID_COLUMN
Name of parameter holding the field ID column
|
protected static String |
__PARAM_MAPPING
Name of parameter holding the fields mapping
|
protected static String |
__PARAM_MAPPING_ATTRIBUTE
Name of parameter into mapping holding the remote attribute
|
protected static String |
__PARAM_MAPPING_METADATA_REF
Name of parameter into mapping holding the path of metadata
|
protected static String |
__PARAM_MAPPING_SYNCHRO
Name of parameter into mapping holding the synchronized property
|
protected ApogeeDAO |
_apogeeDAO
The DAO for remote DB Apogee
|
protected Set<String> |
_columns
Synchronized fields
|
protected Context |
_context
Context
|
protected Set<ApogeeCriterion> |
_criteria
Synchronized fields
|
protected Set<String> |
_extFields
External fields
|
protected String |
_idColumn
Name of the Apogée column which contains the ID
|
protected JSONUtils |
_jsonUtils
The JSON utils
|
protected Map<String,List<String>> |
_mapping
Mapping between metadata and columns
|
protected String |
_odfLang
Default language configured for ODF
|
protected Set<String> |
_syncFields
Synchronized fields
|
static String |
HANDLE_CONTENTS
Request attribute name to store handle contents during import or synchronization.
|
_contentHelper, _languagesManager, _sccHelper, _synchronizingContentOperatorEP
_contentDAO, _contentTypeEP, _currentUserProvider, _hasGlobalError, _i18nUtils, _nbCreatedContents, _nbDeletedContents, _nbError, _nbNotChangedContents, _nbSynchronizedContents, _observationManager, _resolver, _synchroComponent, SCC_UNIQUE_ID
_contentPrefix, _contentType, _id, _initialActionId, _label, _modelId, _modelParamValues, _removalSync, _reportMails, _restrictedField, _searchModelConfiguration, _synchronizeExistingContentsOnly, _synchronizingContentOperator, _validateActionId, _validateAfterImport, _workflowName
COLLECTION_ID_PROPERTY
Constructor and Description |
---|
AbstractApogeeSynchronizableContentsCollection() |
Modifier and Type | Method and Description |
---|---|
protected List<Map<String,Object>> |
_convertBigDecimal(List<Map<String,Object>> searchResults)
Convert the
BigDecimal values retrieved from database into long values |
protected boolean |
_fillContent(Map<String,List<Object>> remoteValues,
ModifiableDefaultContent content,
boolean create,
Logger logger)
Fill the content with remote values.
|
private I18nizableText |
_getCriterionLabel(Configuration configuration,
String defaultValue) |
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,
Logger logger)
Import a content from remote values.
|
protected List<ModifiableDefaultContent> |
_importOrSynchronizeContent(String idValue,
Map<String,List<Object>> remoteValues,
boolean forceImport,
Logger logger)
Imports or synchronizes a content for each available language
|
protected abstract List<Map<String,Object>> |
_search(Map<String,Object> searchParams,
Logger logger)
Search the contents with the search parameters.
|
protected ModifiableDefaultContent |
_synchronizeContent(ModifiableDefaultContent content,
Map<String,List<Object>> remoteValues,
Logger logger)
Synchronize a content with remove values.
|
protected Object |
_transformClobToString(Object value,
String idValue,
Logger logger)
Transform CLOB value to String value.
|
private Map<String,List<Object>> |
_transformOrgUnitMetadata(Map<String,List<Object>> remoteValues,
Logger logger) |
protected boolean |
additionalImportOperations(ModifiableDefaultContent content,
Map<String,List<Object>> remoteValues,
Map<String,Object> importParams,
Logger logger)
Add specific fields to the content.
|
protected boolean |
additionalSynchronizeOperations(ModifiableDefaultContent content,
Map<String,List<Object>> remoteValues,
Logger logger)
Add specific fields to the content.
|
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) |
Set<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 identifier
|
Set<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,
Logger logger)
Search values and return the result organized by metadata
|
protected Set<String> |
getRichTextFields()
Get the list of rich text fields of the imported content.
|
private String |
getSort(List<Object> sortList) |
int |
getTotalCount(Map<String,Object> parameters,
Logger logger)
Return the total number of results for the search.
|
protected boolean |
handleChildren(ModifiableDefaultContent content,
Logger logger)
Set the children metadata and invert relation, import and synchronize the children too.
|
protected boolean |
handleParent(ModifiableDefaultContent currentContent,
ModifiableDefaultContent parentContent,
Logger logger)
Set the parent metadata and invert relation.
|
boolean |
handleRightAssignmentContext()
Return true if a
RightAssignmentContext should be automatically generated for the contents of this SCC |
List<ModifiableDefaultContent> |
importContent(String idValue,
Map<String,Object> importParams,
Logger logger)
Import a content from remote values.
|
protected boolean |
importOrSynchronizeChildren(ModifiableDefaultContent content,
String sccModelId,
String metadataName,
String invertMetadataName,
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,
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,
Logger logger)
Search values and return the result without any treatment.
|
List<ModifiableDefaultContent> |
populate(Logger logger)
Populates contents
|
protected 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,
Logger logger)
Set the additional metadata.
|
void |
synchronizeContent(ModifiableDefaultContent content,
Logger logger)
Synchronize a content with remove values.
|
_getContentsToRemove, _getIdFieldValue, _handleContent, _importOrSynchronizeContent, _importOrSynchronizeContents, _internalPopulate, _isHandled, configure, createContentAction, getContent, getTransformedRemoteValues, search, updateSyncInformations, validateContent
_getContentPathQuery, _getExpressionsList, _getMetadataHolder, _isParamNotEmpty, _removeEmptyParameters, _removeMetadataIfExists, _synchronizeMetadata, _updateRelation, _updateRelation, applyChanges, applyChanges, createContentAction, deleteUnexistingContents, sendErrorMail, updateSCCProperty, validateContent
_parseParameters, configureStaticParams, getContentPrefix, getContentType, getId, getInitialActionId, getLabel, getParameterValues, getReportMails, getRestrictedField, getSearchModelConfiguration, getSynchronizeCollectionModelId, getSynchronizingContentOperator, getValidateActionId, getWorkflowName, removalSync, synchronizeExistingContentsOnly, validateAfterImport
public static final String HANDLE_CONTENTS
protected static final String __PARAM_ID_COLUMN
protected static final String __PARAM_MAPPING
protected static final String __PARAM_MAPPING_SYNCHRO
protected static final String __PARAM_MAPPING_METADATA_REF
protected static final String __PARAM_MAPPING_ATTRIBUTE
protected static final String __PARAM_CRITERIA
protected static final String __PARAM_CRITERIA_CRITERION
protected static final String __PARAM_CRITERIA_CRITERION_ID
protected static final String __PARAM_CRITERIA_CRITERION_LABEL
protected static final String __PARAM_CRITERIA_CRITERION_TYPE
protected static final String __PARAM_COLUMNS
protected static final String __PARAM_COLUMNS_COLUMN
protected Set<String> _extFields
protected Set<String> _syncFields
protected Set<ApogeeCriterion> _criteria
protected ApogeeDAO _apogeeDAO
protected JSONUtils _jsonUtils
public AbstractApogeeSynchronizableContentsCollection()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
service
in class AbstractSimpleSynchronizableContentsCollection
ServiceException
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
protected void configureDataSource(Configuration configuration) throws ConfigurationException
AbstractStaticSynchronizableContentsCollection
configureDataSource
in class AbstractStaticSynchronizableContentsCollection
configuration
- Configuration to readConfigurationException
- If an error occursprivate I18nizableText _getCriterionLabel(Configuration configuration, String defaultValue)
public List<ModifiableDefaultContent> populate(Logger logger)
SynchronizableContentsCollection
populate
in interface SynchronizableContentsCollection
populate
in class AbstractSimpleSynchronizableContentsCollection
logger
- The loggerprotected Map<String,Map<String,Object>> internalSearch(Map<String,Object> parameters, int offset, int limit, List<Object> sort, Logger logger)
AbstractSimpleSynchronizableContentsCollection
internalSearch
in class AbstractSimpleSynchronizableContentsCollection
parameters
- Search parameters to restrict the searchoffset
- Begin of the searchlimit
- Number of resultssort
- Sort of results (ignored for LDAP results)logger
- The loggerprotected Map<String,Map<String,List<Object>>> getRemoteValues(Map<String,Object> parameters, Logger logger)
AbstractSimpleSynchronizableContentsCollection
getRemoteValues
in class AbstractSimpleSynchronizableContentsCollection
parameters
- Search parameters to restrict the searchlogger
- The loggerprotected List<ModifiableDefaultContent> _importOrSynchronizeContent(String idValue, Map<String,List<Object>> remoteValues, boolean forceImport, Logger logger)
AbstractSimpleSynchronizableContentsCollection
_importOrSynchronizeContent
in class AbstractSimpleSynchronizableContentsCollection
idValue
- The unique identifier of the contentremoteValues
- The remote valuesforceImport
- To force import and ignoring the synchronize existing contents only optionlogger
- The loggerpublic List<ModifiableDefaultContent> importContent(String idValue, Map<String,Object> importParams, Logger logger) throws Exception
SynchronizableContentsCollection
importContent
in interface SynchronizableContentsCollection
importContent
in class AbstractSimpleSynchronizableContentsCollection
idValue
- Id (for import/synchronization) of the content to importimportParams
- Additional parameterslogger
- The loggerException
- if an error occurs.public void synchronizeContent(ModifiableDefaultContent content, Logger logger) throws Exception
SynchronizableContentsCollection
synchronizeContent
in interface SynchronizableContentsCollection
synchronizeContent
in class AbstractSimpleSynchronizableContentsCollection
content
- The content to synchronizelogger
- The loggerException
- if an error occurs.protected Map<String,Object> putIdParameter(String idValue)
AbstractSimpleSynchronizableContentsCollection
putIdParameter
in class AbstractSimpleSynchronizableContentsCollection
idValue
- Value to searchprotected abstract List<Map<String,Object>> _search(Map<String,Object> searchParams, Logger logger)
searchParams
- Search parameterslogger
- The loggerprotected List<Map<String,Object>> _convertBigDecimal(List<Map<String,Object>> searchResults)
BigDecimal
values retrieved from database into long valuessearchResults
- The initial search results from databaseprotected Object _transformClobToString(Object value, String idValue, Logger logger)
value
- The input valueidValue
- The identifier of the programlogger
- The loggerprotected abstract String getMappingName()
protected String getIdColumn()
public String getIdField()
SynchronizableContentsCollection
getIdField
in interface SynchronizableContentsCollection
public Set<String> getLocalAndExternalFields(Map<String,Object> additionalParameters)
SynchronizableContentsCollection
getLocalAndExternalFields
in interface SynchronizableContentsCollection
additionalParameters
- Additional parameterspublic Set<String> getExternalOnlyFields(Map<String,Object> additionalParameters)
SynchronizableContentsCollection
getExternalOnlyFields
in interface SynchronizableContentsCollection
additionalParameters
- Additional parametersprotected boolean _fillContent(Map<String,List<Object>> remoteValues, ModifiableDefaultContent content, boolean create, Logger logger)
AbstractSimpleSynchronizableContentsCollection
_fillContent
in class AbstractSimpleSynchronizableContentsCollection
remoteValues
- The remote valuescontent
- The content to synchronizecreate
- true
if content is creating, false if it is updatedlogger
- The loggertrue
if changes were madeprotected boolean _handleAdditionalMetadata(ModifiableCompositeMetadata holder, boolean create)
holder
- The holder of the content to updatecreate
- If we are on creation modetrue
if changes has been madeprotected Set<String> getRichTextFields()
protected void configureSearchModel()
AbstractStaticSynchronizableContentsCollection
configureSearchModel
in class AbstractStaticSynchronizableContentsCollection
protected boolean additionalImportOperations(ModifiableDefaultContent content, Map<String,List<Object>> remoteValues, Map<String,Object> importParams, Logger logger)
AbstractSimpleSynchronizableContentsCollection
additionalImportOperations
in class AbstractSimpleSynchronizableContentsCollection
content
- Content to updateremoteValues
- Values of the contentimportParams
- Import parameterslogger
- The loggertrue
if there are changesprotected boolean additionalSynchronizeOperations(ModifiableDefaultContent content, Map<String,List<Object>> remoteValues, Logger logger)
AbstractSimpleSynchronizableContentsCollection
additionalSynchronizeOperations
in class AbstractSimpleSynchronizableContentsCollection
content
- Content to updateremoteValues
- Values of the contentlogger
- The loggertrue
if there are changesprotected boolean handleParent(ModifiableDefaultContent currentContent, ModifiableDefaultContent parentContent, Logger logger)
currentContent
- Current contentparentContent
- Parent content to setlogger
- The loggertrue
if there are changesprotected boolean handleChildren(ModifiableDefaultContent content, Logger logger)
content
- Current contentlogger
- The loggertrue
if there are changesprotected boolean setAdditionalMetadata(ModifiableDefaultContent content, Map<String,List<Object>> remoteValues, Logger logger)
content
- Current contentremoteValues
- Values of the contentlogger
- The loggertrue
if there are changespublic int getTotalCount(Map<String,Object> parameters, Logger logger)
SynchronizableContentsCollection
getTotalCount
in interface SynchronizableContentsCollection
getTotalCount
in class AbstractSimpleSynchronizableContentsCollection
parameters
- Parameters for the searchlogger
- The loggerprotected ModifiableDefaultContent _importContent(String idValue, Map<String,Object> importParams, String lang, Map<String,List<Object>> remoteValues, Logger logger) throws Exception
AbstractSimpleSynchronizableContentsCollection
_importContent
in class AbstractSimpleSynchronizableContentsCollection
idValue
- Id (for import/synchronization) of the content to importimportParams
- Specific parameters for importlang
- Lang of the contentremoteValues
- Values of the contentlogger
- The loggerException
- if an error occurs.protected ModifiableDefaultContent _synchronizeContent(ModifiableDefaultContent content, Map<String,List<Object>> remoteValues, Logger logger) throws Exception
AbstractSimpleSynchronizableContentsCollection
_synchronizeContent
in class AbstractSimpleSynchronizableContentsCollection
content
- The content to synchronizeremoteValues
- Values to synchronizelogger
- The loggerException
- if an error occurs.protected boolean importOrSynchronizeChildren(ModifiableDefaultContent content, String sccModelId, String metadataName, String invertMetadataName, Logger logger)
content
- Parent contentsccModelId
- SCC model IDmetadataName
- Metadata name to setinvertMetadataName
- Metadata name of the invert relationlogger
- The loggertrue
if there are changespublic List<ModifiableDefaultContent> importOrSynchronizeContents(Map<String,Object> searchParams, Logger logger)
ApogeeSynchronizableContentsCollection
importOrSynchronizeContents
in interface ApogeeSynchronizableContentsCollection
searchParams
- Search parameterslogger
- The loggerList
of ModifiableDefaultContent
of children (imported or synchronized)protected boolean addToHandleContents(String contentId)
contentId
- Content IDtrue
if the content ID have been added, false
is returned if the content ID already exists in the handle contents list.private Map<String,List<Object>> _transformOrgUnitMetadata(Map<String,List<Object>> remoteValues, Logger logger)
public boolean handleRightAssignmentContext()
SynchronizableContentsCollection
RightAssignmentContext
should be automatically generated for the contents of this SCChandleRightAssignmentContext
in interface SynchronizableContentsCollection
RightAssignmentContext
. Return false if the rights of contents of this SCC are handle by its own RightAssignmentContext