public class CoreDirectorySession extends BaseSession
Modifier and Type | Field and Description |
---|---|
protected CoreSession |
coreSession |
protected String |
createPath |
protected String |
docType |
protected String |
schemaIdField |
protected String |
schemaPasswordField |
protected static String |
UUID_FIELD |
autoincrementId, directory, directoryName, MULTI_TENANT_ID_FORMAT, passwordHashAlgorithm, permissions, POWER_USERS_GROUP, readAllColumns, READONLY_ENTRY_FLAG, referenceClass, schemaName, substringMatchType
Constructor and Description |
---|
CoreDirectorySession(CoreDirectory directory) |
Modifier and Type | Method and Description |
---|---|
boolean |
authenticate(String username,
String password)
Checks that the credentials provided by the UserManager match those registered in the directory.
|
void |
close()
Closes the session and all open result sets obtained from this session.
|
DocumentModel |
createEntry(Map<String,Object> fieldMap)
Creates an entry in a directory.
|
DocumentModel |
createEntryWithoutReferences(Map<String,Object> fieldMap)
To be implemented for specific creation.
|
void |
deleteEntry(DocumentModel docModel)
Deletes a directory entry.
|
void |
deleteEntry(String id)
Deletes a directory entry by id.
|
void |
deleteEntry(String id,
Map<String,String> map)
Deletes a directory entry by id and secondary ids.
|
protected void |
deleteEntryWithoutReferences(String id)
To be implemented for specific deletion.
|
CoreDirectory |
getDirectory()
To be implemented with a more specific return type.
|
DocumentModelList |
getEntries()
Retrieves all the entries in the directory.
|
DocumentModel |
getEntry(String id,
boolean fetchReferences)
Retrieves a directory entry using its id.
|
protected String |
getMappedPrefixedFieldName(String fieldName) |
List<String> |
getProjection(Map<String,Serializable> filter,
Set<String> fulltext,
String columnName) |
List<String> |
getProjection(Map<String,Serializable> filter,
String columnName)
Executes a query using filter and return only the column columnName.
|
boolean |
hasEntry(String id)
Returns true if session has an entry with given id.
|
boolean |
isAuthenticating()
Tells whether the directory implementation can be used as an authenticating backend for the UserManager (based on
login / password check).
|
DocumentModelList |
query(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.
|
void |
updateEntry(DocumentModel docModel)
Updates a directory entry.
|
protected List<String> |
updateEntryWithoutReferences(DocumentModel docModel)
To be implemented for specific update.
|
checkDeleteConstraints, checkPermission, computeMultiTenantDirectoryId, createEntry, createEntryModel, createEntryModel, getEntry, getEntryFromSource, getIdField, getPasswordField, hasPermission, hasPermission, isReadOnly, isReadOnlyEntry, query, query, query, query, setReadAllColumns, setReadOnlyEntry, setReadWriteEntry
protected final String schemaIdField
protected final String schemaPasswordField
protected final CoreSession coreSession
protected final String createPath
protected static final String UUID_FIELD
public CoreDirectorySession(CoreDirectory directory)
public CoreDirectory getDirectory()
BaseSession
getDirectory
in class BaseSession
public DocumentModel getEntry(String id, boolean fetchReferences) throws DirectoryException
Session
getEntry
in interface Session
getEntry
in class BaseSession
id
- the entry idfetchReferences
- boolean stating if references have to be fetchedDirectoryException
public DocumentModelList getEntries() throws DirectoryException
Session
DocumentModelList#totalsize
on the returned list will return
-2 as a special marker for truncated results.getEntries
in interface Session
getEntries
in class BaseSession
DirectoryException
SizeLimitExceededException
- if the number of results is larger than the limit configured for the directory
and the server does not send partial results.public DocumentModel createEntryWithoutReferences(Map<String,Object> fieldMap) throws DirectoryException
BaseSession
createEntryWithoutReferences
in class BaseSession
DirectoryException
protected List<String> updateEntryWithoutReferences(DocumentModel docModel) throws DirectoryException
BaseSession
updateEntryWithoutReferences
in class BaseSession
DirectoryException
protected void deleteEntryWithoutReferences(String id) throws DirectoryException
BaseSession
deleteEntryWithoutReferences
in class BaseSession
DirectoryException
public DocumentModel createEntry(Map<String,Object> fieldMap) throws DirectoryException
Session
createEntry
in interface Session
createEntry
in class BaseSession
fieldMap
- A map with keys and values that should be stored in a directory
Note: The values in the map should be of type String
DirectoryException
- if a communication exception occurs or if an entry with the same id already exists.public void updateEntry(DocumentModel docModel) throws DirectoryException
Session
updateEntry
in interface Session
updateEntry
in class BaseSession
docModel
- The entry to updateDirectoryException
- if a communication error occurspublic void deleteEntry(DocumentModel docModel) throws DirectoryException
Session
deleteEntry
in interface Session
deleteEntry
in class BaseSession
docModel
- The entry to deleteDirectoryException
- if a communication error occurspublic void deleteEntry(String id) throws DirectoryException
Session
deleteEntry
in interface Session
deleteEntry
in class BaseSession
id
- the id of the entry to deleteDirectoryException
- if a communication error occurspublic void deleteEntry(String id, Map<String,String> map) throws DirectoryException
Session
This is used for hierarchical vocabularies, where the actual unique key is the couple (parent, id).
deleteEntry
in interface Session
deleteEntry
in class BaseSession
id
- the id of the entry to delete.map
- a map of secondary key values.DirectoryException
- if a communication error occurs.protected String getMappedPrefixedFieldName(String fieldName)
public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences, int limit, int offset) throws DirectoryException
Session
query
in interface Session
query
in class BaseSession
limit
- maximum number of results ignored if less than 1offset
- number of rows skipped before starting, will be 0 if less than 0.DirectoryException
Session.query(Map, Set, Map, boolean)
public void close() throws DirectoryException
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?
DirectoryException
- if a communication error occurspublic List<String> getProjection(Map<String,Serializable> filter, String columnName) throws DirectoryException
Session
getProjection
in interface Session
getProjection
in class BaseSession
filter
- the filter for the querycolumnName
- the column whose content should be returnedDirectoryException
SizeLimitExceededException
- if the number of results is larger than the limit configured for the directorypublic List<String> getProjection(Map<String,Serializable> filter, Set<String> fulltext, String columnName) throws DirectoryException
getProjection
in interface Session
getProjection
in class BaseSession
DirectoryException
public boolean authenticate(String username, String password)
Session
public boolean isAuthenticating()
Session
isAuthenticating
in interface Session
isAuthenticating
in class BaseSession
Copyright © 2018 Nuxeo. All rights reserved.