public class MemoryDirectorySession extends BaseSession
Modifier and Type | Field and Description |
---|---|
protected Map<String,Map<String,Object>> |
data |
directory, MULTI_TENANT_ID_FORMAT, permissions, POWER_USERS_GROUP, READONLY_ENTRY_FLAG
Constructor and Description |
---|
MemoryDirectorySession(MemoryDirectory 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.
|
void |
commit() |
DocumentModel |
createEntry(DocumentModel entry)
Creates an entry in a directory.
|
DocumentModel |
createEntry(Map<String,Object> fieldMap)
Creates an entry in a directory.
|
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.
|
MemoryDirectory |
getDirectory()
To be implemented with a more specific type.
|
DocumentModelList |
getEntries()
Retrieves all the entries in the directory.
|
DocumentModel |
getEntry(String id)
Retrieves a directory entry using its id.
|
DocumentModel |
getEntry(String id,
boolean fetchReferences)
Retrieves a directory entry using its id.
|
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.
|
DocumentModelList |
query(Map<String,Serializable> filter)
Executes a simple query.
|
DocumentModelList |
query(Map<String,Serializable> filter,
Set<String> fulltext)
Executes a simple query.
|
DocumentModelList |
query(Map<String,Serializable> filter,
Set<String> fulltext,
Map<String,String> orderBy)
Executes a simple query.
|
DocumentModelList |
query(Map<String,Serializable> filter,
Set<String> fulltext,
Map<String,String> orderBy,
boolean fetchReferences)
Executes a query with the possibility to fetch references
|
void |
rollback() |
void |
updateEntry(DocumentModel docModel)
Updates a directory entry.
|
checkDeleteConstraints, checkPermission, computeMultiTenantDirectoryId, createEntryModel, createEntryModel, getIdField, getPasswordField, hasPermission, hasPermission, isAuthenticating, isReadOnly, isReadOnlyEntry, mkObjectMap, mkSerializableMap, query, setReadOnlyEntry, setReadWriteEntry
public MemoryDirectorySession(MemoryDirectory directory)
public MemoryDirectory getDirectory()
getDirectory
in class BaseSession
public boolean authenticate(String username, String password) throws DirectoryException
Session
DirectoryException
public void close()
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?
public void commit()
public void rollback() throws DirectoryException
DirectoryException
public DocumentModel createEntry(Map<String,Object> fieldMap) throws DirectoryException
Session
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 DocumentModel getEntry(String id) throws DirectoryException
Session
TODO what happens when the entry is not found? return null if not found?
id
- the entry idDirectoryException
public DocumentModel getEntry(String id, boolean fetchReferences) throws DirectoryException
Session
id
- the entry idfetchReferences
- boolean stating if references have to be fetchedDirectoryException
public void updateEntry(DocumentModel docModel) throws DirectoryException
Session
docModel
- The entry to updateDirectoryException
- if a communication error occurspublic DocumentModelList getEntries() throws DirectoryException
Session
DocumentModelList#totalsize
on the returned list will return
-2 as a special marker for truncated results.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 void deleteEntry(String id) throws DirectoryException
Session
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).
id
- the id of the entry to delete.map
- a map of seconday key values.DirectoryException
- if a communication error occurs.public void deleteEntry(DocumentModel docModel) throws DirectoryException
Session
docModel
- The entry to deleteDirectoryException
- if a communication error occurspublic DocumentModelList query(Map<String,Serializable> filter) throws DirectoryException
Session
Does not fetch reference fields.
If the remote server issues a size limit exceeded error while sending partial results up to that limit, the methodDocumentModelList#totalsize
on the returned list will return -2 as a special marker for truncated
results.filter
- a filter to apply to entries in directoryDirectoryException
- if a communication error occursSizeLimitExceededException
- if the number of results is larger than the limit configured for the directory
and the server does not send partial results.public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext) throws DirectoryException
Session
fieldNames present in the fulltext set are treated as a fulltext match. Does not fetch reference fields.
If the remote server issues a size limit exceeded error while sending partial results up to that limit, the methodDocumentModelList#totalsize
on the returned list will return -2 as a special marker for truncated
results.filter
- a filter to apply to entries in directoryfulltext
- a set of field that should be treated as a fulltext searchDirectoryException
- if a communication error occursSizeLimitExceededException
- if the number of results is larger than the limit configured for the directory
and the server does not send partial results.public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy) throws DirectoryException
Session
fieldNames present in the fulltext set are treated as a fulltext match. Does not fetch reference fields.
If the remote server issues a size limit exceeded error while sending partial results up to that limit, the methodDocumentModelList#totalsize
on the returned list will return -2 as a special marker for truncated
results.filter
- a filter to apply to entries in directoryfulltext
- a set of field that should be treated as a fulltext searchorderBy
- a LinkedHashMap with the 'order by' criterias.The key of an entry of this map represents the
column name and the value of the same entry represent the column order,which may be 'asc' or 'desc'.DirectoryException
- if a communication error occursSizeLimitExceededException
- if the number of results is larger than the limit configured for the directory
and the server does not send partial results.public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences) throws DirectoryException
Session
DirectoryException
Session.query(Map, Set, Map)
public List<String> getProjection(Map<String,Serializable> filter, String columnName) throws DirectoryException
Session
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
DirectoryException
public DocumentModel createEntry(DocumentModel entry)
Session
entry
- the document model representing the entry to createCopyright © 2016 Nuxeo SA. All rights reserved.