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 attributeprotected static final String
Name of parameter for the firstname attributeprotected static final String
Name of parameter for the lastname attributeprotected 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 attributeprotected 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 componentprotected JSONUtils
The JSON utilsprotected static final Logger
The loggerprotected ServiceManager
The service managerMapping of the attributes with source dataSynchronized fieldsprotected UserPopulationDAO
The DAO for user populationsFields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
_contentHelper, _synchronizingContentOperatorEP
Fields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_contentWorkflowHelper, _currentUserProvider, _hasGlobalError, _i18nUtils, _nbCreatedContents, _nbDeletedContents, _nbError, _nbNotChangedContents, _nbSynchronizedContents, _observationManager, SCC_UNIQUE_ID
Fields inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_contentDAO, _contentPrefix, _contentType, _contentTypeEP, _id, _ignoreRestrictions, _initialActionId, _label, _languages, _modelId, _modelParamValues, _removalSync, _reportMails, _resolver, _restrictedField, _sccHelper, _searchModelConfiguration, _synchronizeActionId, _synchronizeExistingContentsOnly, _synchronizingContentOperator, _validateActionId, _validateAfterImport, _workflowName
Fields inherited from interface org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollection
COLLECTION_ID_DATA_NAME, RESULT_NB_CREATED_CONTENTS, RESULT_NB_DELETED_CONTENTS, RESULT_NB_NOT_CHANGED_CONTENTS, RESULT_NB_SYNCHRONIZED_CONTENTS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
_deleteContents
(List<Content> contentsToRemove, Logger logger) Delete contents.protected List<ModifiableContent>
_internalPopulate
(Logger logger) Internal implementation ofAbstractSynchronizableContentsCollection.populate(Logger)
_userToSearchResult
(User user) Transform user to search resultprotected void
configureDataSource
(Configuration configuration) Configure the data source parameters.protected void
Configure the search model used by SCCSearchTool.getAdditionalAttributeValues
(String idValue, Content content, Map<String, Object> additionalParameters, boolean create, Logger logger) Retrieves additional values to synchronize for a contentGet the additional filter for searchingGet the attribute name for the emailGet the attribute name for the first nameGet the path of metadata holding the unique identifierGet the attribute name for the last namegetLocalAndExternalFields
(Map<String, Object> additionalParameters) Get the path of tri-state fields (with local and external values)Get the attribute name for the loginGet the id of the user populationgetRemoteValues
(Map<String, Object> searchParameters, Logger logger) Search values and return the result organized by attributesboolean
Return true if aRightAssignmentContext
should be automatically generated for the contents of this SCCinternalSearch
(Map<String, Object> searchParameters, 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> searchParameters, 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
_addEditInputsForSCC, _editContent, _fillContent, _getContentsToRemove, _getEditInputs, _getEditInputsContextParameters, _handleContent, _importContent, _importOrSynchronizeContent, _importOrSynchronizeContent, _importOrSynchronizeContents, _isHandled, _synchronizeContent, _transformRemoteValues, configure, createContentAction, getContent, getNotSynchronizedRelatedContentIds, getTotalCount, getTransformedRemoteValues, importContent, populate, search, synchronizeContent, updateSyncInformations, validateContent
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_getAdditionalInputsForContentCreation, _getContentPathQuery, _getExpressionsList, _hasSomethingChanged, _isParamNotEmpty, _logSynchronizationResult, _removeEmptyParameters, createContentAction, deleteUnexistingContents, empty, getSynchronizationResult, sendErrorMail, validateContent
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
_parseLanguages, _parseParameters, _transformRemoteValuesCardinality, configureStaticParams, getContentPrefix, getContentType, getId, getInitialActionId, getLabel, getLanguages, getParameterValues, getReportMails, getRestrictedField, getSearchModelConfiguration, getSynchronizeActionId, getSynchronizeCollectionModelId, getSynchronizingContentOperator, getValidateActionId, getWorkflowName, ignoreRestrictions, removalSync, synchronizeExistingContentsOnly, validateAfterImport
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollection
additionalCommonOperations, additionalImportOperations, additionalSynchronizeOperations
-
Field Details
-
__PARAM_POPULATION_ID
Name of parameter holding the id of population- See Also:
-
__PARAM_FIRSTNAME_ATTRIBUTE_NAME
Name of parameter for the firstname attribute- See Also:
-
__PARAM_LASTNAME_ATTRIBUTE_NAME
Name of parameter for the lastname attribute- See Also:
-
__PARAM_EMAIL_ATTRIBUTE_NAME
Name of parameter for the email attribute- 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_ATTRIBUTE_REF
Name of parameter into mapping holding the path of attribute- 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 -
_deleteUserComponent
The delete user component -
_mapping
Mapping of the attributes with source data -
_syncFields
Synchronized 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> searchParameters, 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 directorysearchParameters
- Parameters for the searchoffset
- Begin of the searchlimit
- Number of resultslogger
- The loggergetRemoteValues
- iftrue
, values are organized by the attribute mapping- Returns:
- Contents found in LDAP
-
internalSearch
protected Map<String,Map<String, internalSearchObject>> (Map<String, Object> searchParameters, 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:
searchParameters
- Search parameters to restrict the searchoffset
- Begin of the searchlimit
- Number of resultssort
- Sort of results (ignored for LDAP results)logger
- The logger- Returns:
- Map of results without any treatment.
-
_userToSearchResult
Transform user to search result- Parameters:
user
- the user- Returns:
- the search result
-
getRemoteValues
protected Map<String,Map<String, getRemoteValuesList<Object>>> (Map<String, Object> searchParameters, Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollection
Search values and return the result organized by attributes- Specified by:
getRemoteValues
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
searchParameters
- Search parameters to restrict the searchlogger
- The logger- Returns:
- Map of results organized by attributes.
-
getAdditionalAttributeValues
protected Map<String,Object> getAdditionalAttributeValues(String idValue, Content content, Map<String, Object> additionalParameters, boolean create, Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollection
Retrieves additional values to synchronize for a content- Overrides:
getAdditionalAttributeValues
in classAbstractSimpleSynchronizableContentsCollection
- Parameters:
idValue
- id value of the contentcontent
- The contentadditionalParameters
- Additional parameterscreate
-true
if the content has been newly created,false
otherwiselogger
- The logger- Returns:
- the values to add
-
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.
-
getLoginAttributeName
Get the attribute name for the login- Returns:
- The the attribute name for the login
-
getFirstNameAttributeName
Get the attribute name for the first name- Returns:
- The the attribute name for the first name
-
getLastNameAttributeName
Get the attribute name for the last name- Returns:
- The the attribute name for the last name
-
getEmailAttributeName
Get the attribute name for the email- Returns:
- The the attribute name for the email
-
getAdditionalSearchFilter
Get the additional filter for searching- Returns:
- The additional filter for searching
-
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
-