public class LDAPSession extends BaseSession implements EntrySource
| Constructor and Description |
|---|
LDAPSession(LDAPDirectory directory,
DirContext dirContext) |
| 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 dm)
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.
|
DirContext |
getContext() |
Directory |
getDirectory() |
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.
|
DocumentModel |
getEntryFromSource(String id,
boolean fetchReferences) |
String |
getIdField()
The Id field is the name of the field that is used a primary key: unique
and not null value in the whole directory.
|
String |
getPasswordField() |
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).
|
boolean |
isReadOnly() |
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,
boolean fetchReferences,
Map<String,String> orderBy) |
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
|
boolean |
rdnMatchesIdField() |
void |
rollback() |
void |
setSubStringMatchType(String type) |
String |
toString() |
void |
updateEntry(DocumentModel docModel)
Updates a directory entry.
|
createEntryModel, createEntryModel, isReadOnlyEntry, setReadOnlyEntry, setReadWriteEntrypublic LDAPSession(LDAPDirectory directory, DirContext dirContext)
public void setSubStringMatchType(String type)
public Directory getDirectory()
public DirContext getContext()
public DocumentModel createEntry(Map<String,Object> fieldMap) throws DirectoryException
SessioncreateEntry in interface SessionfieldMap - 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
SessionTODO what happens when the entry is not found? return null if not found?
getEntry in interface Sessionid - the entry idDirectoryExceptionpublic DocumentModel getEntry(String id, boolean fetchReferences) throws DirectoryException
SessiongetEntry in interface Sessionid - the entry idfetchReferences - boolean stating if references have to be fetchedDirectoryExceptionpublic DocumentModel getEntryFromSource(String id, boolean fetchReferences) throws DirectoryException
getEntryFromSource in interface EntrySourceDirectoryExceptionpublic boolean hasEntry(String id) throws DirectoryException
SessionhasEntry in interface SessionDirectoryExceptionpublic DocumentModelList getEntries() throws DirectoryException
SessiongetEntries in interface SessionDirectoryExceptionSizeLimitExceededException - if the number of results is larger
than the limit configured for the directorypublic void updateEntry(DocumentModel docModel) throws DirectoryException
SessionupdateEntry in interface SessiondocModel - The entry to updateDirectoryException - if a communication error occurspublic void deleteEntry(DocumentModel dm) throws DirectoryException
SessiondeleteEntry in interface Sessiondm - The entry to deleteDirectoryException - if a communication error occurspublic void deleteEntry(String id) throws DirectoryException
SessiondeleteEntry in interface Sessionid - the id of the entry to deleteDirectoryException - if a communication error occurspublic void deleteEntry(String id, Map<String,String> map) throws DirectoryException
SessionThis is used for hierarchical vocabularies, where the actual unique key is the couple (parent, id).
deleteEntry in interface Sessionid - the id of the entry to delete.map - a map of seconday key values.DirectoryException - if a communication error occurs.public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, boolean fetchReferences, Map<String,String> orderBy) throws DirectoryException
DirectoryExceptionpublic DocumentModelList query(Map<String,Serializable> filter) throws DirectoryException
SessionDoes not fetch reference fields.
query in interface Sessionfilter - 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 directorypublic DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy) throws DirectoryException
SessionfieldNames present in the fulltext set are treated as a fulltext match. Does not fetch reference fields.
query in interface Sessionfilter - 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 directorypublic DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences) throws DirectoryException
Sessionquery in interface SessionDirectoryExceptionSession.query(Map, Set, Map)public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext) throws DirectoryException
SessionfieldNames present in the fulltext set are treated as a fulltext match. Does not fetch reference fields.
query in interface Sessionfilter - 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 directorypublic void close()
throws DirectoryException
SessionReleases this Connection object's resources immediately instead of waiting for them to be automatically released.
TODO: should this operation auto-commit pending changes?
close in interface SessionDirectoryException - if a communication error occurspublic List<String> getProjection(Map<String,Serializable> filter, String columnName) throws DirectoryException
SessiongetProjection in interface Sessionfilter - the filter for the querycolumnName - the column whose content should be returnedDirectoryExceptionSizeLimitExceededException - 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 SessionDirectoryExceptionpublic boolean authenticate(String username, String password) throws DirectoryException
Sessionauthenticate in interface SessionDirectoryExceptionpublic String getIdField()
SessiongetIdField in interface Sessionpublic String getPasswordField()
getPasswordField in interface Sessionpublic boolean isAuthenticating()
throws DirectoryException
SessionisAuthenticating in interface SessionDirectoryExceptionpublic boolean isReadOnly()
isReadOnly in interface Sessionpublic boolean rdnMatchesIdField()
public DocumentModel createEntry(DocumentModel entry) throws ClientException
SessioncreateEntry in interface Sessionentry - the document model representing the entry to createClientException - if a communication exception occurs or if an
entry with the same id already exists.Copyright © 2011 Nuxeo SA. All Rights Reserved.