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
Modifier and TypeFieldDescriptionprotected DeleteOrgUnitComponent
The delete orgUnit componentprotected Integer
Number of updated contents for parent-child org unit relationprotected OrganisationChartPageHandler
The organisation chart page handlerThe map which link orgunit with this parentThe map which link orgunit with sql remote idsprotected OutgoingReferencesExtractor
The OutgoingReferences extractorprotected SQLUserSearchDAO
The sql user search DAOprotected CurrentUserProvider
The current user providerThe map which link users (userId and role) to their orgunitsstatic final String
The internal data name for orgUnit remote sql idstatic final String
The result map key for number of deleted contentsFields inherited from class org.ametys.plugins.contentio.synchronize.impl.SQLSynchronizableContentsCollection
_sqlCollectionDAO
Fields 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, _syncFields
Fields 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, 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
_deleteContents
(List<Content> contentsToRemove, Logger logger) Delete contents.protected Content
_getOrgUnitContentFromRemoteId
(String remoteId, String lang, 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, Logger logger) Get the parameters map for user mybatis search_getUserByOrgUnit
(String orgUnitKey, String loginColumnName, String roleColumnName, Map<String, Object> normalizedUser, Logger logger) Retrieves aTriple
containing 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
(Logger logger) Retrieves the user attributes for all org unitsprotected boolean
Checks if some content have changed during the synchronizationprotected Optional<ModifiableContent>
_importOrSynchronizeContent
(String idValue, String lang, Map<String, List<Object>> remoteValues, boolean forceImport, Logger logger) Imports or synchronizes a content for a given languageprotected List<ModifiableContent>
_internalPopulate
(Logger logger, ContainerProgressionTracker progressionTracker) Internal implementation ofAbstractSynchronizableContentsCollection.populate(Logger, ContainerProgressionTracker)
protected void
_logSynchronizationResult
(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, Logger logger) Set all orgunit parents relation for each synchronized contentadditionalCommonOperations
(ModifiableContent content, Map<String, Object> additionalParameters, Logger logger) Add specific fields to the content during import or synchronization.getAdditionalAttributeValues
(String idValue, Content content, Map<String, Object> additionalParameters, boolean create, 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 tableboolean
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.boolean
True if the SQL sort for users prevailvoid
service
(ServiceManager smanager) Methods inherited from class org.ametys.plugins.contentio.synchronize.impl.SQLSynchronizableContentsCollection
_checkIdObjectValue, _getNormalizedSearchResult, _getTotalCounParameters, _normalizeSearchResult, getTableName, getTotalCount
Methods inherited from class org.ametys.plugins.contentio.synchronize.impl.AbstractDataSourceSynchronizableContentsCollection
configureDataSource, configureSearchModel, getDataSourceId, getIdField, getLocalAndExternalFields, getMapping, getRemoteValues, putIdParameter
Methods 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, validateContent
Methods inherited from class org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
_getAdditionalInputsForContentCreation, _getContentPathQuery, _getExpressionsList, _internalPopulate, _isParamNotEmpty, _removeEmptyParameters, createContentAction, deleteUnexistingContents, empty, 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
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:
service
in interfaceServiceable
- Overrides:
service
in classSQLSynchronizableContentsCollection
- 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
-
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:SQLSynchronizableContentsCollection
Get the parameters map for mybatis search- Overrides:
_getSearchParameters
in 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, Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollection
Search values and return the result without any treatment.- Overrides:
internalSearch
in 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:AbstractSynchronizableContentsCollection
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 contents
- Overrides:
_logSynchronizationResult
in classAbstractSynchronizableContentsCollection
- Parameters:
logger
- the logger
-
_hasSomethingChanged
Description copied from class:AbstractSynchronizableContentsCollection
Checks if some content have changed during the synchronization- Overrides:
_hasSomethingChanged
in classAbstractSynchronizableContentsCollection
- Returns:
true
if some contents have changed,false
otherwise
-
_internalPopulate
protected List<ModifiableContent> _internalPopulate(Logger logger, ContainerProgressionTracker progressionTracker) Description copied from class:AbstractSynchronizableContentsCollection
Internal implementation ofAbstractSynchronizableContentsCollection.populate(Logger, ContainerProgressionTracker)
- Overrides:
_internalPopulate
in 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, Logger logger) Retrieves aTriple
containing 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, Logger logger) Description copied from class:AbstractSimpleSynchronizableContentsCollection
Imports or synchronizes a content for a given language- Overrides:
_importOrSynchronizeContent
in 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, Logger logger) Description copied from interface:SynchronizableContentsCollection
Add 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, 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
-
_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, 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
Get orgunit content from the remote Id- Parameters:
remoteId
- the remote Idlang
- the languagelogger
- the logger- Returns:
- the orgunit content
-
_getSearchUserParameters
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:AbstractSynchronizableContentsCollection
Delete contents.- Overrides:
_deleteContents
in classAbstractSynchronizableContentsCollection
- Parameters:
contentsToRemove
- List of contents to removelogger
- The logger- Returns:
- the number of deleted contents
-
getSynchronizationResult
Description copied from interface:SynchronizableContentsCollection
Retrieves 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:
getSynchronizationResult
in interfaceSynchronizableContentsCollection
- Overrides:
getSynchronizationResult
in classAbstractSynchronizableContentsCollection
- Returns:
- the result of the synchronization
-