Class UserPopulationSynchronizableContentsCollection
java.lang.Object
org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
org.ametys.plugins.userdirectory.synchronize.UserPopulationSynchronizableContentsCollection
- All Implemented Interfaces:
SynchronizableContentsCollection
,Configurable
,Serviceable
public class UserPopulationSynchronizableContentsCollection
extends AbstractSimpleSynchronizableContentsCollection
Implementation of
SynchronizableContentsCollection
to be synchronized with a UserPopulation
of the CMS.-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
Name of parameter holding the additional search filterprotected static final String
Name of parameter for the email metadataprotected static final String
Name of parameter for the firstname metadataprotected static final String
Name of parameter for the lastname metadataprotected static final String
Name of parameter for the login metadataprotected static final String
Name of parameter holding the fields mappingprotected static final String
Name of parameter into mapping holding the remote attributeprotected static final String
Name of parameter into mapping holding the path of metadataprotected static final String
Name of parameter into mapping holding the synchronized propertyprotected static final String
Name of parameter holding the id of populationprotected DeleteUserComponent
The delete user componentExternal fieldsprotected JSONUtils
The JSON utilsprotected static final Logger
The loggerprotected ServiceManager
The service managerMapping of the metadata with source dataSynchronized fieldsprotected UserPopulationDAO
The DAO for user populationsprotected UserSCCHelper
The user SCC helperFields 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
_deleteContents
(List<Content> contentsToRemove, Logger logger) Delete contents.protected boolean
_fillContent
(Map<String, List<Object>> remoteValues, ModifiableDefaultContent content, boolean create, Logger logger) Fill the content with remote values.protected List<ModifiableDefaultContent>
_internalPopulate
(Logger logger) Internal implementation ofAbstractSynchronizableContentsCollection.populate(Logger)
protected void
configureDataSource
(Configuration configuration) Configure the data source parameters.protected void
Configure the search model used by SCCSearchTool.Get the additional filter for searchingGet the metadata name for the emailgetExternalOnlyFields
(Map<String, Object> additionalParameters) Get the path of field that are valued externally only.Get the metadata name for the first nameGet the path of metadata holding the unique identifierGet the metadata name for the last namegetLocalAndExternalFields
(Map<String, Object> additionalParameters) Get the path of tri-state fields (with local and external values)Get the metadata name for the loginGet the id of the user populationgetRemoteValues
(Map<String, Object> parameters, Logger logger) Search values and return the result organized by metadataboolean
Return true if aRightAssignmentContext
should be automatically generated for the contents of this SCCinternalSearch
(Map<String, Object> parameters, int offset, int limit, List<Object> sort, Logger logger) Search values and return the result without any treatment.putIdParameter
(String idValue) Set search parameters for the ID value.searchLDAP
(LdapUserDirectory userDirectory, Map<String, Object> parameters, int offset, int limit, Logger logger, boolean getRemoteValues) Search contents from a LDAP user directory of the population.void
service
(ServiceManager manager) Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
_getContentsToRemove, _getIdFieldValue, _handleContent, _importContent, _importOrSynchronizeContent, _importOrSynchronizeContent, _importOrSynchronizeContents, _isHandled, _synchronizeContent, additionalCommonOperations, additionalImportOperations, additionalSynchronizeOperations, configure, createContentAction, getContent, getTotalCount, getTransformedRemoteValues, importContent, populate, search, synchronizeContent, 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, 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 Details
-
__PARAM_POPULATION_ID
Name of parameter holding the id of population- See Also:
-
__PARAM_LOGIN_METADATA_NAME
Name of parameter for the login metadata- See Also:
-
__PARAM_FIRSTNAME_METADATA_NAME
Name of parameter for the firstname metadata- See Also:
-
__PARAM_LASTNAME_METADATA_NAME
Name of parameter for the lastname metadata- See Also:
-
__PARAM_EMAIL_METADATA_NAME
Name of parameter for the email metadata- See Also:
-
__PARAM_MAPPING
Name of parameter holding the fields mapping- See Also:
-
__PARAM_ADDITIONAL_SEARCH_FILTER
Name of parameter holding the additional search filter- See Also:
-
__PARAM_MAPPING_SYNCHRO
Name of parameter into mapping holding the synchronized property- See Also:
-
__PARAM_MAPPING_METADATA_REF
Name of parameter into mapping holding the path of metadata- See Also:
-
__PARAM_MAPPING_ATTRIBUTE_PREFIX
Name of parameter into mapping holding the remote attribute- See Also:
-
_LOGGER
The logger -
_userPopulationDAO
The DAO for user populations -
_manager
The service manager -
_jsonUtils
The JSON utils -
_userSCCHelper
The user SCC helper -
_deleteUserComponent
The delete user component -
_mapping
Mapping of the metadata with source data -
_syncFields
Synchronized fields -
_extFields
External fields
-
-
Constructor Details
-
UserPopulationSynchronizableContentsCollection
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSimpleSynchronizableContentsCollection
- Throws:
ServiceException
-
handleRightAssignmentContext
Description copied from interface:SynchronizableContentsCollection
Return true if aRightAssignmentContext
should be automatically generated for the contents of this SCC- Returns:
- true to automatically generate a
RightAssignmentContext
. Return false if the rights of contents of this SCC are handle by its ownRightAssignmentContext
-
configureDataSource
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
-
configureSearchModel
Description copied from class:AbstractStaticSynchronizableContentsCollection
Configure the search model used by SCCSearchTool.- Specified by:
configureSearchModel
in classAbstractStaticSynchronizableContentsCollection
-
_internalPopulate
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
-
searchLDAP
protected Map<String,Map<String, searchLDAPObject>> (LdapUserDirectory userDirectory, Map<String, Object> parameters, int offset, int limit, Logger logger, boolean getRemoteValues) Search contents from a LDAP user directory of the population. To avoid code duplication and useless operations, we return aMap
<String
,Map
<String
,Object
>> if getRemoteValues is set to false andMap
<String
,Map
<String
,List
<Object
>>> if remoteValues is true. Without this operation, we have to duplicate the code of searchLDAP and _internalSearch methods.- Parameters:
userDirectory
- The LDAP user directoryparameters
- Parameters for the searchoffset
- Begin of the searchlimit
- Number of resultslogger
- The loggergetRemoteValues
- if true, values are organized by the metadata mapping- Returns:
- Contents found in LDAP
-
internalSearch
protected Map<String,Map<String, internalSearchObject>> (Map<String, Object> parameters, int offset, int limit, List<Object> sort, 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.
-
_fillContent
protected boolean _fillContent(Map<String, List<Object>> remoteValues, ModifiableDefaultContent content, boolean create, 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
-
getRemoteValues
protected Map<String,Map<String, getRemoteValuesList<Object>>> (Map<String, Object> parameters, 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.
-
getPopulationId
Get the id of the user population- Returns:
- The id of user population
-
getIdField
Description copied from interface:SynchronizableContentsCollection
Get the path of metadata holding the unique identifier- Returns:
- the path to the metadata. Can be null.
-
getLoginMetadata
Get the metadata name for the login- Returns:
- The the metadata name for the login
-
getFirstNameMetadata
Get the metadata name for the first name- Returns:
- The the metadata name for the first name
-
getLastNameMetadata
Get the metadata name for the last name- Returns:
- The the metadata name for the last name
-
getEmailMetadata
Get the metadata name for the email- Returns:
- The the metadata name for the email
-
getAdditionalSearchFilter
Get the additional filter for searching- Returns:
- The additional filter for searching
-
getExternalOnlyFields
Description copied from interface:SynchronizableContentsCollection
Get the path of field that are valued externally only.- Parameters:
additionalParameters
- Additional parameters- Returns:
- the external fields
-
getLocalAndExternalFields
Description copied from interface:SynchronizableContentsCollection
Get the path of tri-state fields (with local and external values)- Parameters:
additionalParameters
- Additional parameters- Returns:
- the synchronized fields
-
putIdParameter
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
-
_deleteContents
Description copied from class:AbstractSynchronizableContentsCollection
Delete contents.- Overrides:
_deleteContents
in classAbstractSynchronizableContentsCollection
- Parameters:
contentsToRemove
- List of contents to removelogger
- The logger- Returns:
- the number of deleted contents
-