Class SQLSynchronizableUDOrgunitCollection
java.lang.Object
org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.impl.AbstractDataSourceSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.impl.SQLSynchronizableContentsCollection
org.ametys.plugins.userdirectory.synchronize.SQLSynchronizableUDOrgunitCollection
- All Implemented Interfaces:
SynchronizableContentsCollection,Component,Configurable,Serviceable
Synchronizable collection for UD Orgunits
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DeleteOrgUnitComponentThe delete orgUnit componentprotected IntegerNumber of updated contents for parent-child org unit relationprotected OrganisationChartPageHandlerThe organisation chart page handlerThe map which link orgunit with this parentThe map which link orgunit with sql remote idsprotected OutgoingReferencesExtractorThe OutgoingReferences extractorprotected SQLUserSearchDAOThe sql user search DAOprotected CurrentUserProviderThe current user providerThe map which link users (userId and role) to their orgunitsstatic final StringThe internal data name for orgUnit remote sql idstatic final StringThe result map key for number of deleted contentsFields inherited from class org.ametys.plugins.contentio.synchronize.impl.SQLSynchronizableContentsCollection
_sqlCollectionDAOFields inherited from class org.ametys.plugins.contentio.synchronize.impl.AbstractDataSourceSynchronizableContentsCollection
__PARAM_DATASOURCE_ID, __PARAM_FIELD_ID, __PARAM_MAPPING, __PARAM_MAPPING_ATTRIBUTE, __PARAM_MAPPING_METADATA_REF, __PARAM_MAPPING_SYNCHRO, _columnsAndCriteria, _jsonUtils, _mapping, _syncFieldsFields 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, org.slf4j.Logger logger) Delete contents.protected Content_getOrgUnitContentFromRemoteId(String remoteId, String lang, org.slf4j.Logger logger) Get orgunit content from the remote Id_getOrgUnitUsers(String orgUnitId, String lang) Retrieves the users of the given orgunit_getSearchParameters(Map<String, Object> parameters, int offset, int limit, List<Object> sort, List<String> columns) Get the parameters map for mybatis search_getSearchUserParameters(String orgUnitColumnKey, org.slf4j.Logger logger) Get the parameters map for user mybatis search_getUserByOrgUnit(String orgUnitKey, String loginColumnName, String roleColumnName, Map<String, Object> normalizedUser, org.slf4j.Logger logger) Retrieves aTriplecontaining the orgunit id, and the user's login and role for the given normalized userprotected Content_getUserContent(String loginValue, String lang) Get user content from login value_getUsersByOrgUnit(org.slf4j.Logger logger) Retrieves the user attributes for all org unitsprotected booleanChecks if some content have changed during the synchronizationprotected Optional<ModifiableContent>_importOrSynchronizeContent(String idValue, String lang, Map<String, List<Object>> remoteValues, boolean forceImport, org.slf4j.Logger logger) Imports or synchronizes a content for a given languageprotected List<ModifiableContent>_internalPopulate(org.slf4j.Logger logger, ContainerProgressionTracker progressionTracker) Internal implementation ofAbstractSynchronizableContentsCollection.populate(Logger, ContainerProgressionTracker)protected void_logSynchronizationResult(org.slf4j.Logger logger) Logs the result of the synchronization, containing The number of created contents The number of synchronized contents The number of unchanged contents The number of deleted contentsprotected void_setContentsRelationWithParentOrgunit(List<ModifiableContent> orgUnitContents, org.slf4j.Logger logger) Set all orgunit parents relation for each synchronized contentadditionalCommonOperations(ModifiableContent content, Map<String, Object> additionalParameters, org.slf4j.Logger logger) Add specific fields to the content during import or synchronization.getAdditionalAttributeValues(String idValue, Content content, Map<String, Object> additionalParameters, boolean create, org.slf4j.Logger logger) Retrieves additional values to synchronize for a contentGet the login user attribute nameGet the login user column nameGet the name of the orgunit join column name of the user tableGet the orgunit remote id column nameGet the role user column nameRetrieves the result of the synchronization as a map of key / content count containing The number of created contents The number of synchronized contents The number of unchanged contents The number of deleted contentsGet the user sort column nameGet the name of user SQL tablebooleanReturn true if aRightAssignmentContextshould be automatically generated for the contents of this SCCinternalSearch(Map<String, Object> searchParameters, int offset, int limit, List<Object> sort, org.slf4j.Logger logger) Search values and return the result without any treatment.booleanTrue if the SQL sort for users prevailvoidservice(ServiceManager smanager) Methods inherited from class org.ametys.plugins.contentio.synchronize.impl.SQLSynchronizableContentsCollection
_checkIdObjectValue, _getNormalizedSearchResult, _getTotalCounParameters, _normalizeSearchResult, getTableName, getTotalCountMethods inherited from class org.ametys.plugins.contentio.synchronize.impl.AbstractDataSourceSynchronizableContentsCollection
configureDataSource, configureSearchModel, getDataSourceId, getIdField, getLocalAndExternalFields, getMapping, getRemoteValues, putIdParameterMethods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSimpleSynchronizableContentsCollection
_addEditInputsForSCC, _editContent, _fillContent, _getContentsToRemove, _getEditInputs, _getEditInputsContextParameters, _handleContent, _importContent, _importOrSynchronizeContent, _importOrSynchronizeContents, _importOrSynchronizeContents, _isHandled, _synchronizeContent, _transformRemoteValues, configure, createContentAction, getContent, getNotSynchronizedRelatedContentIds, getTransformedRemoteValues, importContent, populate, search, synchronizeContent, updateSyncInformations, validateContentMethods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_getAdditionalInputsForContentCreation, _getContentPathQuery, _getExpressionsList, _internalPopulate, _isParamNotEmpty, _removeEmptyParameters, createContentAction, deleteUnexistingContents, empty, 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
additionalImportOperations, additionalSynchronizeOperations
-
Field Details
-
ORGUNIT_REMOTE_ID_INTERNAL_DATA
The internal data name for orgUnit remote sql id- See Also:
-
RESULT_NB_SYNCHRONIZED_ORGUNITS_RELATIONS
The result map key for number of deleted contents- See Also:
-
_orgUnitParents
The map which link orgunit with this parent -
_usersByOrgUnitId
The map which link users (userId and role) to their orgunits -
_orgUnitRemoteIds
The map which link orgunit with sql remote ids -
_nbSynchronizedOrgUnit
Number of updated contents for parent-child org unit relation -
_sqlUserDAO
The sql user search DAO -
_orgChartPageHandler
The organisation chart page handler -
_userProvider
The current user provider -
_outgoingReferencesExtractor
The OutgoingReferences extractor -
_deleteOrgUnitComponent
The delete orgUnit component
-
-
Constructor Details
-
SQLSynchronizableUDOrgunitCollection
public SQLSynchronizableUDOrgunitCollection()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classSQLSynchronizableContentsCollection- 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
-
getUserTableName
Get the name of user SQL table- Returns:
- The user SQL table name
-
getOrgunitJoinColumnNameForUser
Get the name of the orgunit join column name of the user table- Returns:
- The name of the orgunit join column name
-
getLoginUserAttributeName
Get the login user attribute name- Returns:
- The login user attribute name
-
getLoginUserColumnName
Get the login user column name- Returns:
- The login user column name
-
getRoleUserColumnName
Get the role user column name- Returns:
- The role user column name
-
getUserSortColumnName
Get the user sort column name- Returns:
- The user sort column name
-
getOrgUnitRemoteIdColumnName
Get the orgunit remote id column name- Returns:
- The orgunit remote id column name
-
isUserSortPrevail
True if the SQL sort for users prevail- Returns:
- true if the SQL sort for users prevail
-
_getSearchParameters
protected Map<String,Object> _getSearchParameters(Map<String, Object> parameters, int offset, int limit, List<Object> sort, List<String> columns) Description copied from class:SQLSynchronizableContentsCollectionGet the parameters map for mybatis search- Overrides:
_getSearchParametersin classSQLSynchronizableContentsCollection- Parameters:
parameters- the filter parameteroffset- the offsetlimit- the limitsort- the sort mapcolumns- the list of columns- Returns:
- the parameter map
-
internalSearch
protected Map<String,Map<String, internalSearchObject>> (Map<String, Object> searchParameters, int offset, int limit, List<Object> sort, org.slf4j.Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollectionSearch values and return the result without any treatment.- Overrides:
internalSearchin classSQLSynchronizableContentsCollection- 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.
-
_logSynchronizationResult
Description copied from class:AbstractSynchronizableContentsCollectionLogs the result of the synchronization, containing- The number of created contents
- The number of synchronized contents
- The number of unchanged contents
- The number of deleted contents
- Overrides:
_logSynchronizationResultin classAbstractSynchronizableContentsCollection- Parameters:
logger- the logger
-
_hasSomethingChanged
Description copied from class:AbstractSynchronizableContentsCollectionChecks if some content have changed during the synchronization- Overrides:
_hasSomethingChangedin classAbstractSynchronizableContentsCollection- Returns:
trueif some contents have changed,falseotherwise
-
_internalPopulate
protected List<ModifiableContent> _internalPopulate(org.slf4j.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
-
_getUsersByOrgUnit
Retrieves the user attributes for all org units- Parameters:
logger- The logger- Returns:
- the org units' users
-
_getUserByOrgUnit
protected Optional<Triple<String,String, _getUserByOrgUnitString>> (String orgUnitKey, String loginColumnName, String roleColumnName, Map<String, Object> normalizedUser, org.slf4j.Logger logger) Retrieves aTriplecontaining the orgunit id, and the user's login and role for the given normalized user- Parameters:
orgUnitKey- the orgUnit keyloginColumnName- the login column nameroleColumnName- the role column namenormalizedUser- the normalized userlogger- the logger- Returns:
- the user info as a
Triple
-
_importOrSynchronizeContent
protected Optional<ModifiableContent> _importOrSynchronizeContent(String idValue, String lang, Map<String, List<Object>> remoteValues, boolean forceImport, org.slf4j.Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollectionImports or synchronizes a content for a given language- Overrides:
_importOrSynchronizeContentin classAbstractSimpleSynchronizableContentsCollection- Parameters:
idValue- The unique identifier of the contentlang- The language of content to import or synchronizeremoteValues- The remote valuesforceImport- To force import and ignoring the synchronize existing contents only optionlogger- The logger- Returns:
- The imported or synchronized content
-
additionalCommonOperations
public ContentSynchronizationResult additionalCommonOperations(ModifiableContent content, Map<String, Object> additionalParameters, org.slf4j.Logger logger) Description copied from interface:SynchronizableContentsCollectionAdd specific fields to the content during import or synchronization.- Parameters:
content- Content to updateadditionalParameters- Additional parameterslogger- The logger- Returns:
- The synchronization result of the additional operations
-
getAdditionalAttributeValues
protected Map<String,Object> getAdditionalAttributeValues(String idValue, Content content, Map<String, Object> additionalParameters, boolean create, org.slf4j.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
-
_getOrgUnitUsers
Retrieves the users of the given orgunit- Parameters:
orgUnitId- the orgunit identifierlang- the language of the orgunit- Returns:
- the users linked to the given orgunit
-
_setContentsRelationWithParentOrgunit
protected void _setContentsRelationWithParentOrgunit(List<ModifiableContent> orgUnitContents, org.slf4j.Logger logger) Set all orgunit parents relation for each synchronized content- Parameters:
orgUnitContents- the synchronized contentlogger- the logger
-
_getUserContent
Get user content from login value- Parameters:
loginValue- the login valuelang- the language- Returns:
- the user content
-
_getOrgUnitContentFromRemoteId
protected Content _getOrgUnitContentFromRemoteId(String remoteId, String lang, org.slf4j.Logger logger) Get orgunit content from the remote Id- Parameters:
remoteId- the remote Idlang- the languagelogger- the logger- Returns:
- the orgunit content
-
_getSearchUserParameters
protected Map<String,Object> _getSearchUserParameters(String orgUnitColumnKey, org.slf4j.Logger logger) Get the parameters map for user mybatis search- Parameters:
orgUnitColumnKey- the column name of the orgunit keylogger- the logger- Returns:
- the parameter map
-
_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
-
getSynchronizationResult
Description copied from interface:SynchronizableContentsCollectionRetrieves the result of the synchronization as a map of key / content count containing- The number of created contents
- The number of synchronized contents
- The number of unchanged contents
- The number of deleted contents
- Specified by:
getSynchronizationResultin interfaceSynchronizableContentsCollection- Overrides:
getSynchronizationResultin classAbstractSynchronizableContentsCollection- Returns:
- the result of the synchronization
-