Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.directory.api
Interface DirectoryManager

All Superinterfaces:
DirectoryService

public interface DirectoryManager
extends DirectoryService

Author:
George Lefter

Field Summary
 
Fields inherited from interface org.nuxeo.ecm.directory.api.DirectoryService
NAME
 
Method Summary
 boolean authenticate(long sessionId, String username, String password)
          Checks that the credentials provided by the UserManager match those registered in the directory.
 void close(long sessionId)
          Closes the session and all open result sets obtained from this session.
 void commit(long sessionId)
          Commits any changes on this session.
 DocumentModel createEntry(long sessionId, DocumentModel entry)
          Creates an entry in a directory.
 DocumentModel createEntry(long sessionId, Map<String,Object> fieldMap)
          Creates an entry in a directory.
 void deleteEntry(long sessionId, DocumentModel docModel)
          Deletes a directory entry.
 void deleteEntry(long sessionId, String id)
          Deletes a directory entry by id.
 void deleteEntry(long sessionId, String id, Map<String,String> map)
          Deletes a directory entry by id and secondary ids.
 DocumentModelList getEntries(long sessionId)
          Retrieves all the entries in the directory.
 DocumentModel getEntry(long sessionId, String id)
          Retrieves a directory entry using its id.
 DocumentModel getEntry(long sessionId, String id, boolean fetchReferences)
          Retrieves a directory entry using its id.
 String getIdField(long sessionId)
          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(long sessionId)
           
 List<String> getProjection(long sessionId, Map<String,Serializable> filter, Set<String> fulltext, String columnName)
           
 List<String> getProjection(long sessionId, Map<String,Serializable> filter, String columnName)
          Executes a query using filter and return only the column columnName.
 boolean hasEntry(long sessionId, String id)
          Returns true if session has an entry with given id.
 boolean isAuthenticating(long sessionId)
          Tells whether the directory implementation can be used as an authenticating backend for the UserManager (based on login / password check).
 boolean isReadOnly(long sessionId)
           
 DocumentModelList query(long sessionId, Map<String,Serializable> filter)
          Executes a simple query.
 DocumentModelList query(long sessionId, Map<String,Serializable> filter, Set<String> fulltext)
          Executes a simple query.
 DocumentModelList query(long sessionId, Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy)
          Executes a simple query.
 DocumentModelList query(long sessionId, Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences)
           
 void rollback(long sessionId)
          Rollbacks any changes on this session.
 void updateEntry(long sessionId, DocumentModel docModel)
          Updates a directory entry.
 
Methods inherited from interface org.nuxeo.ecm.directory.api.DirectoryService
getDirectories, getDirectory, getDirectory, getDirectoryIdField, getDirectoryNames, getDirectoryPasswordField, getDirectorySchema, getParentDirectoryName, open, open, registerDirectory, unregisterDirectory
 

Method Detail

getEntry

DocumentModel getEntry(long sessionId,
                       String id)
                       throws DirectoryException
Retrieves a directory entry using its id.

TODO what happens when the entry is not found? return null if not found?

Parameters:
id - the entry id
Returns:
a DocumentModel representing the entry
Throws:
DirectoryException

getEntry

DocumentModel getEntry(long sessionId,
                       String id,
                       boolean fetchReferences)
                       throws DirectoryException
Retrieves a directory entry using its id.

Parameters:
id - the entry id
fetchReferences - boolean stating if references have to be fetched
Returns:
a DocumentModel representing the entry
Throws:
DirectoryException
See Also:
getEntry(long, String)

getEntries

DocumentModelList getEntries(long sessionId)
                             throws DirectoryException
Retrieves all the entries in the directory.

Returns:
a collection with all the entries in the directory
Throws:
DirectoryException
SizeLimitExceededException - if the number of results is larger than the limit configured for the directory

createEntry

DocumentModel createEntry(long sessionId,
                          Map<String,Object> fieldMap)
                          throws DirectoryException
Creates an entry in a directory.

Parameters:
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

Returns:
The new entry created in the directory
Throws:
UnsupportedOperationException - if the directory does not allow the creation of new entries
DirectoryException - if a communication exception occurs or if an entry with the same id already exists.

updateEntry

void updateEntry(long sessionId,
                 DocumentModel docModel)
                 throws DirectoryException
Updates a directory entry.

Parameters:
docModel - The entry to update
Throws:
UnsupportedOperationException - if the directory does not support entry updating
DirectoryException - if a communication error occurs

deleteEntry

void deleteEntry(long sessionId,
                 DocumentModel docModel)
                 throws DirectoryException
Deletes a directory entry.

Parameters:
docModel - The entry to delete
Throws:
UnsupportedOperationException - if the directory does not support entry deleting
DirectoryException - if a communication error occurs

deleteEntry

void deleteEntry(long sessionId,
                 String id)
                 throws DirectoryException
Deletes a directory entry by id.

Parameters:
id - the id of the entry to delete
Throws:
UnsupportedOperationException - if the directory does not support entry deleting
DirectoryException - if a communication error occurs

deleteEntry

void deleteEntry(long sessionId,
                 String id,
                 Map<String,String> map)
                 throws DirectoryException
Deletes a directory entry by id and secondary ids.

This is used for hierarchical vocabularies, where the actual unique key is the couple (parent, id).

Parameters:
sessionId - the session id.
id - the id of the entry to delete.
map - a map of seconday key values.
Throws:
DirectoryException - if a communication error occurs.

query

DocumentModelList query(long sessionId,
                        Map<String,Serializable> filter)
                        throws DirectoryException
Executes a simple query. The conditions will be 'AND'-ed. Search is done with exact match.

Parameters:
filter - a filter to apply to entries in directory
Returns:
a list of document models containing the entries matched by the query
Throws:
DirectoryException - if a communication error occurs
SizeLimitExceededException - if the number of results is larger than the limit configured for the directory

query

DocumentModelList query(long sessionId,
                        Map<String,Serializable> filter,
                        Set<String> fulltext)
                        throws DirectoryException
Executes a simple query. The conditions will be 'AND'-ed.

fieldNames present in the fulltext set are treated as a fulltext match.

Parameters:
filter - a filter to apply to entries in directory
fulltext - a set of field that should be treated as a fulltext search
Returns:
a list of document models containing the entries matched by the query
Throws:
DirectoryException - if a communication error occurs
SizeLimitExceededException - if the number of results is larger than the limit configured for the directory

query

DocumentModelList query(long sessionId,
                        Map<String,Serializable> filter,
                        Set<String> fulltext,
                        Map<String,String> orderBy)
                        throws DirectoryException
Executes a simple query. The conditions will be 'AND'-ed and the result will be sorted by the orderBy criteria list.

fieldNames present in the fulltext set are treated as a fulltext match.

Parameters:
filter - a filter to apply to entries in directory
orderBy - 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'.
fulltext - a set of field that should be treated as a fulltext search
Returns:
a list of document models containing the entries matched by the query
Throws:
DirectoryException - if a communication error occurs
SizeLimitExceededException - if the number of results is larger than the limit configured for the directory

query

DocumentModelList query(long sessionId,
                        Map<String,Serializable> filter,
                        Set<String> fulltext,
                        Map<String,String> orderBy,
                        boolean fetchReferences)
                        throws DirectoryException
Throws:
DirectoryException

commit

void commit(long sessionId)
            throws DirectoryException
Commits any changes on this session.

Throws:
UnsupportedOperationException - if the directory does not support transactions
DirectoryException - if a communication error occurs

In this case the session will be automatically rollbacked


rollback

void rollback(long sessionId)
              throws DirectoryException
Rollbacks any changes on this session.

Throws:
UnsupportedOperationException - if the associated directory does not support transactions
DirectoryException - if a communication error occurs

In this case, the session will be automatically rollbacked anyway


close

void close(long sessionId)
           throws DirectoryException
Closes 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?

Throws:
DirectoryException - if a communication error occurs

getProjection

List<String> getProjection(long sessionId,
                           Map<String,Serializable> filter,
                           String columnName)
                           throws DirectoryException
Executes a query using filter and return only the column columnName.

Parameters:
filter - the filter for the query
columnName - the column whose content should be returned
Returns:
the list with the values of columnName for the entries matching filter
Throws:
DirectoryException
SizeLimitExceededException - if the number of results is larger than the limit configured for the directory

getProjection

List<String> getProjection(long sessionId,
                           Map<String,Serializable> filter,
                           Set<String> fulltext,
                           String columnName)
                           throws DirectoryException
Throws:
DirectoryException

isAuthenticating

boolean isAuthenticating(long sessionId)
                         throws DirectoryException
Tells whether the directory implementation can be used as an authenticating backend for the UserManager (based on login / password check).

Returns:
true is the directory is authentication aware
Throws:
DirectoryException

authenticate

boolean authenticate(long sessionId,
                     String username,
                     String password)
                     throws DirectoryException
Checks 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.

Parameters:
username -
password -
Returns:
true is the credentials match those stored in the directory
Throws:
DirectoryException

getIdField

String getIdField(long sessionId)
                  throws DirectoryException
The Id field is the name of the field that is used a primary key: unique and not null value in the whole directory. This field is also used as login field if the directory is authenticating.

Returns:
the name of the id field
Throws:
DirectoryException

getPasswordField

String getPasswordField(long sessionId)
                        throws DirectoryException
Returns:
the name of the field to store the password if the directory is authenticating (can be null)
Throws:
DirectoryException

isReadOnly

boolean isReadOnly(long sessionId)
                   throws DirectoryException
Throws:
DirectoryException

hasEntry

boolean hasEntry(long sessionId,
                 String id)
                 throws DirectoryException
Returns true if session has an entry with given id.

Throws:
DirectoryException
Since:
5.2M4

createEntry

DocumentModel createEntry(long sessionId,
                          DocumentModel entry)
                          throws DirectoryException
Creates an entry in a directory.

Parameters:
entry - the document model representing the entry to create
Returns:
The new entry created in the directory
Throws:
UnsupportedOperationException - if the directory does not allow the creation of new entries
DirectoryException - if a communication exception occurs or if an entry with the same id already exists.
Since:
5.2M4

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.