| 
 | Nuxeo Enterprise Platform 5.3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuxeo.ecm.directory.BaseSession
org.nuxeo.ecm.directory.sql.SQLSession
public class SQLSession
This class represents a session against an SQLDirectory.
| Field Summary | |
|---|---|
| protected  Set<String> | emptySet | 
| protected  Map<String,Field> | schemaFieldMap | 
| protected  SQLStaticFilter[] | staticFilters | 
| protected  List<String> | storedFieldNames | 
| Fields inherited from class org.nuxeo.ecm.directory.BaseSession | 
|---|
| READONLY_ENTRY_FLAG | 
| Constructor Summary | |
|---|---|
| SQLSession(SQLDirectory directory,
           SQLDirectoryDescriptor config,
           IdGenerator idGenerator,
           boolean managedSQLSession) | |
| Method Summary | |
|---|---|
| protected  void | addFilterValues(PreparedStatement ps,
                int startIdx) | 
| protected  String | addFilterWhereClause(String whereClause) | 
|  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()Commits any changes on this session. | 
|  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. | 
| protected  DocumentModel | fieldMapToDocumentModel(Map<String,Object> fieldMap) | 
|  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. | 
|  Connection | getSqlConnection()Public getter to allow custom Referenceimplementation to access
 the current connection even if it lives in a separate java package,
 typically: com.company.custom.nuxeo.project.MyCustomReference | 
|  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,
      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()Rollbacks any changes on this session. | 
|  void | updateEntry(DocumentModel docModel)Updates a directory entry. | 
| Methods inherited from class org.nuxeo.ecm.directory.BaseSession | 
|---|
| createEntryModel, createEntryModel, isReadOnlyEntry, mkObjectMap, mkSerializableMap, setReadOnlyEntry, setReadWriteEntry | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected final Map<String,Field> schemaFieldMap
protected final List<String> storedFieldNames
protected final Set<String> emptySet
protected SQLStaticFilter[] staticFilters
| Constructor Detail | 
|---|
public SQLSession(SQLDirectory directory,
                  SQLDirectoryDescriptor config,
                  IdGenerator idGenerator,
                  boolean managedSQLSession)
           throws DirectoryException
DirectoryException| Method Detail | 
|---|
public Directory getDirectory()
protected DocumentModel fieldMapToDocumentModel(Map<String,Object> fieldMap)
public DocumentModel createEntry(Map<String,Object> fieldMap)
                          throws ClientException
Session
createEntry 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.
ClientException
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 id
DirectoryException
public DocumentModel getEntry(String id,
                              boolean fetchReferences)
                       throws DirectoryException
Session
getEntry in interface Sessionid - the entry idfetchReferences - boolean stating if references have to be fetched
DirectoryException
protected String addFilterWhereClause(String whereClause)
                               throws DirectoryException
DirectoryException
protected void addFilterValues(PreparedStatement ps,
                               int startIdx)
                        throws DirectoryException
DirectoryException
public DocumentModel getEntryFromSource(String id,
                                        boolean fetchReferences)
                                 throws DirectoryException
getEntryFromSource in interface EntrySourceDirectoryException
public DocumentModelList getEntries()
                             throws ClientException
Session
getEntries in interface SessionDirectoryException
SizeLimitExceededException - if the number of results is larger
             than the limit configured for the directory
ClientException
public void updateEntry(DocumentModel docModel)
                 throws ClientException
Session
updateEntry in interface SessiondocModel - The entry to update
DirectoryException - if a communication error occurs
ClientException
public void deleteEntry(DocumentModel docModel)
                 throws ClientException
Session
deleteEntry in interface SessiondocModel - The entry to delete
DirectoryException - if a communication error occurs
ClientException
public void deleteEntry(String id)
                 throws ClientException
Session
deleteEntry in interface Sessionid - the id of the entry to delete
DirectoryException - if a communication error occurs
ClientException
public 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,
                               Map<String,String> orderBy)
                        throws ClientException
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 occurs
SizeLimitExceededException - if the number of results is larger
             than the limit configured for the directory
ClientException
public DocumentModelList query(Map<String,Serializable> filter,
                               Set<String> fulltext,
                               Map<String,String> orderBy,
                               boolean fetchReferences)
                        throws ClientException
Session
query in interface SessionClientExceptionSession.query(Map, Set, Map)
public DocumentModelList query(Map<String,Serializable> filter)
                        throws ClientException
SessionDoes not fetch reference fields.
query in interface Sessionfilter - a filter to apply to entries in directory
DirectoryException - if a communication error occurs
SizeLimitExceededException - if the number of results is larger
             than the limit configured for the directory
ClientException
public void commit()
            throws DirectoryException
Session
commit in interface SessionDirectoryException - if a communication error occurs
             In this case the session will be automatically rollbacked
public void rollback()
              throws DirectoryException
Session
rollback in interface SessionDirectoryException - if a communication error occurs
             In this case, the session will be automatically rollbacked anyway
public 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 occurs
public List<String> getProjection(Map<String,Serializable> filter,
                                  Set<String> fulltext,
                                  String columnName)
                           throws ClientException
getProjection in interface SessionClientException
public List<String> getProjection(Map<String,Serializable> filter,
                                  String columnName)
                           throws ClientException
Session
getProjection in interface Sessionfilter - the filter for the querycolumnName - the column whose content should be returned
DirectoryException
SizeLimitExceededException - if the number of results is larger
             than the limit configured for the directory
ClientException
public boolean authenticate(String username,
                            String password)
                     throws ClientException
Session
authenticate in interface SessionClientException
public boolean isAuthenticating()
                         throws ClientException
Session
isAuthenticating in interface SessionDirectoryException
ClientExceptionpublic String getIdField()
Session
getIdField in interface Sessionpublic String getPasswordField()
getPasswordField in interface Sessionpublic boolean isReadOnly()
isReadOnly in interface Session
public DocumentModelList query(Map<String,Serializable> filter,
                               Set<String> fulltext)
                        throws ClientException
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
            search
DirectoryException - if a communication error occurs
SizeLimitExceededException - if the number of results is larger
             than the limit configured for the directory
ClientException
public DocumentModel createEntry(DocumentModel entry)
                          throws ClientException
Session
createEntry in interface Sessionentry - the document model representing the entry to create
ClientException - if a communication exception occurs or if an
             entry with the same id already exists.
public boolean hasEntry(String id)
                 throws ClientException
Session
hasEntry in interface SessionClientExceptionpublic Connection getSqlConnection()
Reference implementation to access
 the current connection even if it lives in a separate java package,
 typically: com.company.custom.nuxeo.project.MyCustomReference
Connection instance| 
 | Nuxeo Enterprise Platform 5.3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||