Package org.nuxeo.ecm.directory.multi
Class MultiDirectorySession
- java.lang.Object
-
- org.nuxeo.ecm.directory.BaseSession
-
- org.nuxeo.ecm.directory.multi.MultiDirectorySession
-
- All Implemented Interfaces:
AutoCloseable,EntrySource,Session
public class MultiDirectorySession extends BaseSession
Directory session aggregating entries from different sources.Each source can build an entry aggregating fields from one or several directories.
- Author:
- Florent Guillaume, Anahide Tchertchian
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classMultiDirectorySession.SourceInfoprotected classMultiDirectorySession.SubDirectoryInfo-
Nested classes/interfaces inherited from class org.nuxeo.ecm.directory.BaseSession
BaseSession.FieldDetector
-
-
Field Summary
-
Fields inherited from class org.nuxeo.ecm.directory.BaseSession
autoincrementId, computeMultiTenantId, directory, directoryName, MULTI_TENANT_ID_FORMAT, passwordHashAlgorithm, permissions, POWER_USERS_GROUP, readAllColumns, READONLY_ENTRY_FLAG, referenceClass, schemaName, substringMatchType, TENANT_ID_FIELD
-
-
Constructor Summary
Constructors Constructor Description MultiDirectorySession(MultiDirectory directory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanauthenticate(String username, String password)Checks that the credentials provided by the UserManager match those registered in the directory.voidclose()Closes the session and all open result sets obtained from this session.DocumentModelcreateEntry(DocumentModel entry)Creates an entry in a directory.DocumentModelcreateEntryWithoutReferences(Map<String,Object> fieldMap)To be implemented for specific creation.voiddeleteEntry(String id)Deletes a directory entry by id.voiddeleteEntry(String id, Map<String,String> map)Deletes a directory entry by id and secondary ids.voiddeleteEntry(DocumentModel docModel)Deletes a directory entry.protected voiddeleteEntryWithoutReferences(String id)To be implemented for specific deletion.MultiDirectorygetDirectory()To be implemented with a more specific return type.DocumentModelListgetEntries()Retrieves all the entries in the directory.DocumentModelgetEntry(String id, boolean fetchReferences)Retrieves a directory entry using its id.StringgetName()List<String>getProjection(Map<String,Serializable> filter, Set<String> fulltext, String columnName)booleanhasEntry(String id)Returns true if session has an entry with given id.DocumentModelListquery(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences, int limit, int offset)Executes a query with the possibility to fetch a subset of the results.DocumentModelListquery(QueryBuilder queryBuilder, boolean fetchReferences)Executes a query with the possibility to fetch a subset of the results.List<String>queryIds(QueryBuilder queryBuilder)Executes a query with the possibility to fetch a subset of the results.voidupdateEntry(DocumentModel docModel)Updates a directory entry.protected List<String>updateEntryWithoutReferences(DocumentModel docModel)To be implemented for specific update.-
Methods inherited from class org.nuxeo.ecm.directory.BaseSession
addTenantId, applyQueryLimits, applyQueryLimits, canDeleteMultiTenantEntry, checkDeleteConstraints, checkPermission, computeMultiTenantDirectoryId, createEntry, createEntryModel, createEntryModel, createEntryModel, createEntryModel, createEntryModel, getCurrentTenantId, getEntry, getEntryFromSource, getIdField, getPasswordField, getProjection, hasPermission, hasPermission, isAuthenticating, isMultiTenant, isReadOnly, isReadOnlyEntry, query, query, query, query, setReadAllColumns, setReadOnlyEntry, setReadWriteEntry, toStringList
-
-
-
-
Constructor Detail
-
MultiDirectorySession
public MultiDirectorySession(MultiDirectory directory)
-
-
Method Detail
-
getDirectory
public MultiDirectory getDirectory()
Description copied from class:BaseSessionTo be implemented with a more specific return type.- Specified by:
getDirectoryin classBaseSession
-
close
public void close()
Description copied from interface:SessionCloses the session and all open result sets obtained from this session.Releases this Connection object's resources immediately instead of waiting for them to be automatically released.
TODO: should this operation auto-commit pending changes?
-
authenticate
public boolean authenticate(String username, String password)
Description copied from interface:SessionChecks that the credentials provided by the UserManager match those registered in the directory. If username is not in the directory, this should return false instead of throrwing an exception.- Returns:
- true is the credentials match those stored in the directory
-
getEntry
public DocumentModel getEntry(String id, boolean fetchReferences)
Description copied from interface:SessionRetrieves a directory entry using its id.- Specified by:
getEntryin interfaceSession- Overrides:
getEntryin classBaseSession- Parameters:
id- the entry idfetchReferences- boolean stating if references have to be fetched- Returns:
- a DocumentModel representing the entry
-
getEntries
public DocumentModelList getEntries()
Description copied from interface:SessionRetrieves all the entries in the directory. If the remote server issues a size limit exceeded error while sending partial results up to that limit, the methodDocumentModelList#totalsizeon the returned list will return -2 as a special marker for truncated results.- Specified by:
getEntriesin interfaceSession- Overrides:
getEntriesin classBaseSession- Returns:
- a collection with all the entries in the directory
-
createEntryWithoutReferences
public DocumentModel createEntryWithoutReferences(Map<String,Object> fieldMap)
Description copied from class:BaseSessionTo be implemented for specific creation.- Specified by:
createEntryWithoutReferencesin classBaseSession
-
updateEntryWithoutReferences
protected List<String> updateEntryWithoutReferences(DocumentModel docModel)
Description copied from class:BaseSessionTo be implemented for specific update.- Specified by:
updateEntryWithoutReferencesin classBaseSession
-
deleteEntryWithoutReferences
protected void deleteEntryWithoutReferences(String id)
Description copied from class:BaseSessionTo be implemented for specific deletion.- Specified by:
deleteEntryWithoutReferencesin classBaseSession
-
deleteEntry
public void deleteEntry(DocumentModel docModel)
Description copied from interface:SessionDeletes a directory entry.- Specified by:
deleteEntryin interfaceSession- Overrides:
deleteEntryin classBaseSession- Parameters:
docModel- The entry to delete
-
deleteEntry
public void deleteEntry(String id)
Description copied from interface:SessionDeletes a directory entry by id.- Specified by:
deleteEntryin interfaceSession- Overrides:
deleteEntryin classBaseSession- Parameters:
id- the id of the entry to delete
-
deleteEntry
public void deleteEntry(String id, Map<String,String> map)
Description copied from interface:SessionDeletes a directory entry by id and secondary ids.This is used for hierarchical vocabularies, where the actual unique key is the couple (parent, id).
- Specified by:
deleteEntryin interfaceSession- Overrides:
deleteEntryin classBaseSession- Parameters:
id- the id of the entry to delete.map- a map of secondary key values.
-
updateEntry
public void updateEntry(DocumentModel docModel)
Description copied from interface:SessionUpdates a directory entry.- Specified by:
updateEntryin interfaceSession- Overrides:
updateEntryin classBaseSession- Parameters:
docModel- The entry to update
-
query
public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences, int limit, int offset)
Description copied from interface:SessionExecutes a query with the possibility to fetch a subset of the results. org.nuxeo.ecm.directory.BaseSession provides a default implementation fetching all results to return the subset. Not recommended.limit- maximum number of results ignored if less than 1offset- number of rows skipped before starting, will be 0 if less than 0.- See Also:
Session.query(Map, Set, Map, boolean)
-
query
public DocumentModelList query(QueryBuilder queryBuilder, boolean fetchReferences)
Description copied from interface:SessionExecutes a query with the possibility to fetch a subset of the results.- Parameters:
queryBuilder- the query to use, including limit, offset, ordering and countTotalfetchReferences- boolean stating if references have to be fetched- Returns:
- the list of documents, where the total size may be present if countTotal was true
-
queryIds
public List<String> queryIds(QueryBuilder queryBuilder)
Description copied from interface:SessionExecutes a query with the possibility to fetch a subset of the results. Returns the matching ids.- Parameters:
queryBuilder- the query to use, including limit, offset and ordering- Returns:
- the list of document ids
-
getProjection
public List<String> getProjection(Map<String,Serializable> filter, Set<String> fulltext, String columnName)
- Specified by:
getProjectionin interfaceSession- Overrides:
getProjectionin classBaseSession
-
createEntry
public DocumentModel createEntry(DocumentModel entry)
Description copied from interface:SessionCreates an entry in a directory.- Specified by:
createEntryin interfaceSession- Overrides:
createEntryin classBaseSession- Parameters:
entry- the document model representing the entry to create- Returns:
- The new entry created in the directory
-
-