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
FieldsModifier and TypeFieldDescriptionprotected static final StringName of parameter holding the additional search filterprotected static final StringName of parameter for the email attributeprotected static final StringName of parameter for the firstname attributeprotected static final StringName of parameter for the lastname attributeprotected static final StringName of parameter holding the fields mappingprotected static final StringName of parameter into mapping holding the remote attributeprotected static final StringName of parameter into mapping holding the path of attributeprotected static final StringName of parameter into mapping holding the synchronized propertyprotected static final StringName of parameter holding the id of populationprotected DeleteUserComponentThe delete user componentprotected JSONUtilsThe JSON utilsprotected LDAPCollectionHelperLDAP collection helper fieldsprotected static final LoggerThe loggerprotected ServiceManagerThe service managerMapping of the attributes with source dataSynchronized fieldsprotected UserPopulationDAOThe DAO for user populationsFields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
_contentHelper, _synchronizingContentOperatorEPFields inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_contentWorkflowHelper, _currentUserProvider, _hasGlobalError, _i18nUtils, _nbCreatedContents, _nbDeletedContents, _nbError, _nbNotChangedContents, _nbSynchronizedContents, _observationManager, SCC_UNIQUE_IDFields 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, _workflowNameFields inherited from interface org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollection
COLLECTION_ID_DATA_NAME, LAST_SYNCHRONIZATION_DATA_NAME, LAST_SYNCHRONIZATION_USER_DATA_NAME, RESULT_NB_CREATED_CONTENTS, RESULT_NB_DELETED_CONTENTS, RESULT_NB_NOT_CHANGED_CONTENTS, RESULT_NB_SYNCHRONIZED_CONTENTS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected int_deleteContents(List<Content> contentsToRemove, Logger logger) Delete contents.protected List<ModifiableContent>_internalPopulate(Logger logger, ContainerProgressionTracker progressionTracker) Internal implementation ofAbstractSynchronizableContentsCollection.populate(Logger, ContainerProgressionTracker)_userToSearchResult(StoredUser storedUser) Transform user to search resultprotected voidconfigureDataSource(Configuration configuration) Configure the data source parameters.protected voidConfigure 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 attributesbooleanReturn true if aRightAssignmentContextshould 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.voidservice(ServiceManager manager) Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
_addEditInputsForSCC, _editContent, _fillContent, _getContentsToRemove, _getEditInputs, _getEditInputsContextParameters, _handleContent, _importContent, _importOrSynchronizeContent, _importOrSynchronizeContent, _importOrSynchronizeContents, _importOrSynchronizeContents, _isHandled, _synchronizeContent, _transformRemoteValues, configure, createContentAction, getContent, getNotSynchronizedRelatedContentIds, getTotalCount, getTransformedRemoteValues, importContent, populate, search, synchronizeContent, updateSyncInformations, validateContentMethods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_getAdditionalInputsForContentCreation, _getContentPathQuery, _getExpressionsList, _hasSomethingChanged, _internalPopulate, _isParamNotEmpty, _logSynchronizationResult, _removeEmptyParameters, createContentAction, deleteUnexistingContents, empty, getSynchronizationResult, sendErrorMail, validateContentMethods 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, validateAfterImportMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 -
_ldapHelper
LDAP collection helper fields
-
-
Constructor Details
-
UserPopulationSynchronizableContentsCollection
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractSimpleSynchronizableContentsCollection- Throws:
ServiceException
-
handleRightAssignmentContext
Description copied from interface:SynchronizableContentsCollectionReturn true if aRightAssignmentContextshould 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:AbstractStaticSynchronizableContentsCollectionConfigure the data source parameters.- Specified by:
configureDataSourcein classAbstractStaticSynchronizableContentsCollection- Parameters:
configuration- Configuration to read- Throws:
ConfigurationException- If an error occurs
-
configureSearchModel
Description copied from class:AbstractStaticSynchronizableContentsCollectionConfigure the search model used by SCCSearchTool.- Specified by:
configureSearchModelin classAbstractStaticSynchronizableContentsCollection
-
_internalPopulate
protected List<ModifiableContent> _internalPopulate(Logger logger, ContainerProgressionTracker progressionTracker) Description copied from class:AbstractSynchronizableContentsCollectionInternal implementation ofAbstractSynchronizableContentsCollection.populate(Logger, ContainerProgressionTracker)- Overrides:
_internalPopulatein classAbstractSimpleSynchronizableContentsCollection- Parameters:
logger- The loggerprogressionTracker- The progression tracker- 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:AbstractSimpleSynchronizableContentsCollectionSearch values and return the result without any treatment.- Specified by:
internalSearchin 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:
storedUser- the user- Returns:
- the search result
-
getRemoteValues
protected Map<String,Map<String, getRemoteValuesList<Object>>> (Map<String, Object> searchParameters, Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollectionSearch values and return the result organized by attributes- Specified by:
getRemoteValuesin 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:AbstractSimpleSynchronizableContentsCollectionRetrieves additional values to synchronize for a content- Overrides:
getAdditionalAttributeValuesin classAbstractSimpleSynchronizableContentsCollection- Parameters:
idValue- id value of the contentcontent- The contentadditionalParameters- Additional parameterscreate-trueif the content has been newly created,falseotherwiselogger- 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:SynchronizableContentsCollectionGet 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:SynchronizableContentsCollectionGet the path of tri-state fields (with local and external values)- Parameters:
additionalParameters- Additional parameters- Returns:
- the synchronized fields
-
putIdParameter
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
-
_deleteContents
Description copied from class:AbstractSynchronizableContentsCollectionDelete contents.- Overrides:
_deleteContentsin classAbstractSynchronizableContentsCollection- Parameters:
contentsToRemove- List of contents to removelogger- The logger- Returns:
- the number of deleted contents
-