Class LDAPCollectionHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.util.ldap.AbstractLDAPConnector
org.ametys.plugins.contentio.synchronize.impl.LDAPCollectionHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
Helper component for
SynchronizableContentsCollection
s which need to access a LDAP-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentTypeExtensionPoint
The content type extension pointstatic final String
Avalon RoleFields inherited from class org.ametys.core.util.ldap.AbstractLDAPConnector
__PAGE_SIZE, _ldapAdminPassword, _ldapAdminRelativeDN, _ldapAliasDerefMode, _ldapAuthenticationMethod, _ldapBaseDN, _ldapFollowReferrals, _ldapUrl, _ldapUseSSL, _pagingSupported, _serverSideSorting
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Object
_getIdValue
(String idKey, SearchResult entry, Logger logger) Gets id value from a ldap entryprotected int
Get the scope as an integer (handlable by the SearchControls) from the scope string.protected SearchControls
Get the LDAP search controls.search
(String collectionId, String relativeDN, String filter, String searchScope, int offset, int limit, Map<String, List<String>> mapping, String idKey, Logger logger, String dataSourceId) Search over the LDAP the data from the filter.void
service
(ServiceManager serviceManager) void
transformTypedAttributes
(Map<String, Map<String, List<Object>>> results, String contentTypeId, Set<String> allAttributes) Transform date and datetime attributes on each result line from timestamp to LocalDate (date) or ZonedDateTime (datetime)Methods inherited from class org.ametys.core.util.ldap.AbstractLDAPConnector
_cleanup, _delayedInitialize, _getConfigParameter, _getContextEnv, _getFilter, _getRootContextEnv, _getSearchScope, _hasMoreEntries, _isPagingSupported, _search, _search, _search, _search, _setResultsControls, _testConnectionsPooled, _testPagingSupported, getSortByFields
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role -
_contentTypeEP
The content type extension point
-
-
Constructor Details
-
LDAPCollectionHelper
public LDAPCollectionHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractLDAPConnector
- Throws:
ServiceException
-
search
public LDAPCollectionHelper.LDAPCollectionHelperSearchResult search(String collectionId, String relativeDN, String filter, String searchScope, int offset, int limit, Map<String, List<String>> mapping, String idKey, Logger logger, String dataSourceId) Search over the LDAP the data from the filter.- Parameters:
collectionId
- The id of the collection being synchronizedrelativeDN
- the name of the context or object to searchfilter
- the filter expression to use for the searchsearchScope
- The search scopeoffset
- Begin of the searchlimit
- Number of resultsmapping
- The mapping for retrieving the remote values (keys are metadata paths)idKey
- The key where to search the id value of the contentlogger
- The loggerdataSourceId
- the datasource id- Returns:
- A map containing the content ids (keys) to import with their remote values (key is attribute, value is the remote value).
-
_getSearchControls
protected SearchControls _getSearchControls(Map<String, List<String>> mapping, String searchScope) throws ProcessingExceptionGet the LDAP search controls.- Parameters:
mapping
- The mappingsearchScope
- The search scope- Returns:
- the search controls.
- Throws:
ProcessingException
- if the scope is not valid
-
_getScope
Get the scope as an integer (handlable by the SearchControls) from the scope string.- Parameters:
scopeStr
- the scope string.- Returns:
- the scope as an integer.
- Throws:
ProcessingException
- if the given scope is not valid
-
_getIdValue
protected Object _getIdValue(String idKey, SearchResult entry, Logger logger) throws NamingException Gets id value from a ldap entry- Parameters:
idKey
- The key where to search the id valueentry
- The ldap entrylogger
- The logger- Returns:
- The attribute value
- Throws:
NamingException
- if a ldap query error occurred
-
transformTypedAttributes
public void transformTypedAttributes(Map<String, Map<String, List<Object>>> results, String contentTypeId, Set<String> allAttributes) Transform date and datetime attributes on each result line from timestamp to LocalDate (date) or ZonedDateTime (datetime)- Parameters:
results
- The results from LDAP sourcecontentTypeId
- Content type ID from which attributes come fromallAttributes
- All mapped attributes
-