Class CoreDirectorySession

java.lang.Object
org.nuxeo.ecm.directory.BaseSession
org.nuxeo.ecm.directory.core.CoreDirectorySession
All Implemented Interfaces:
AutoCloseable, EntrySource, Session

public class CoreDirectorySession extends BaseSession
Session class for directory on repository
Since:
8.2
  • Field Details

    • schemaIdField

      protected final String schemaIdField
    • schemaPasswordField

      protected final String schemaPasswordField
    • coreSession

      protected final CoreSession coreSession
    • createPath

      protected final String createPath
    • docType

      protected final String docType
    • UUID_FIELD

      protected static final String UUID_FIELD
      See Also:
  • Constructor Details

    • CoreDirectorySession

      public CoreDirectorySession(CoreDirectory directory)
  • Method Details

    • getDirectory

      public CoreDirectory getDirectory()
      Description copied from class: BaseSession
      To be implemented with a more specific return type.
      Specified by:
      getDirectory in class BaseSession
    • getEntry

      public DocumentModel getEntry(String id, boolean fetchReferences)
      Description copied from interface: Session
      Retrieves a directory entry using its id.
      Specified by:
      getEntry in interface Session
      Overrides:
      getEntry in class BaseSession
      Parameters:
      id - the entry id
      fetchReferences - boolean stating if references have to be fetched
      Returns:
      a DocumentModel representing the entry
    • createEntryWithoutReferences

      public DocumentModel createEntryWithoutReferences(Map<String,Object> fieldMap)
      Description copied from class: BaseSession
      To be implemented for specific creation.
      Specified by:
      createEntryWithoutReferences in class BaseSession
    • updateEntryWithoutReferences

      protected List<String> updateEntryWithoutReferences(DocumentModel docModel)
      Description copied from class: BaseSession
      To be implemented for specific update.
      Specified by:
      updateEntryWithoutReferences in class BaseSession
    • deleteEntryWithoutReferences

      protected void deleteEntryWithoutReferences(String id)
      Description copied from class: BaseSession
      To be implemented for specific deletion.
      Specified by:
      deleteEntryWithoutReferences in class BaseSession
    • createEntry

      public DocumentModel createEntry(Map<String,Object> fieldMap)
      Description copied from interface: Session
      Creates an entry in a directory.
      Specified by:
      createEntry in interface Session
      Overrides:
      createEntry in class BaseSession
      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
    • setReferenceTargetIds

      protected void setReferenceTargetIds(DocumentModel docModel, DocumentModel targetHolderDoc, String referenceFieldName)
    • updateEntry

      public void updateEntry(DocumentModel docModel)
      Description copied from interface: Session
      Updates a directory entry.
      Specified by:
      updateEntry in interface Session
      Overrides:
      updateEntry in class BaseSession
      Parameters:
      docModel - The entry to update
    • deleteEntry

      public void deleteEntry(DocumentModel docModel)
      Description copied from interface: Session
      Deletes a directory entry.
      Specified by:
      deleteEntry in interface Session
      Overrides:
      deleteEntry in class BaseSession
      Parameters:
      docModel - The entry to delete
    • deleteEntry

      public void deleteEntry(String id)
      Description copied from interface: Session
      Deletes a directory entry by id.
      Specified by:
      deleteEntry in interface Session
      Overrides:
      deleteEntry in class BaseSession
      Parameters:
      id - the id of the entry to delete
    • getMappedPrefixedFieldName

      protected String getMappedPrefixedFieldName(String fieldName)
    • query

      public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences, int limit, int offset)
      Description copied from interface: Session
      Executes a query with the possibility to fetch a subset of the results. org.nuxeo.ecm.directory.BaseSession provides a default implementation fetching all results to return the subset. Not recommended.
      limit - maximum number of results ignored if less than 1
      offset - number of rows skipped before starting, will be 0 if less than 0.
      See Also:
    • query

      public DocumentModelList query(QueryBuilder queryBuilder, boolean fetchReferences)
      Description copied from interface: Session
      Executes a query with the possibility to fetch a subset of the results.
      Parameters:
      queryBuilder - the query to use, including limit, offset, ordering and countTotal
      fetchReferences - boolean stating if references have to be fetched
      Returns:
      the list of documents, where the total size may be present if countTotal was true
    • queryIds

      public List<String> queryIds(QueryBuilder queryBuilder)
      Description copied from interface: Session
      Executes a query with the possibility to fetch a subset of the results. Returns the matching ids.
      Parameters:
      queryBuilder - the query to use, including limit, offset and ordering
      Returns:
      the list of document ids
    • close

      public void close()
      Description copied from interface: Session
      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?

    • getProjection

      public List<String> getProjection(Map<String,Serializable> filter, String columnName)
      Description copied from interface: Session
      Executes a query using filter and return only the column columnName.
      Specified by:
      getProjection in interface Session
      Overrides:
      getProjection in class BaseSession
      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
    • getProjection

      public List<String> getProjection(Map<String,Serializable> filter, Set<String> fulltext, String columnName)
      Specified by:
      getProjection in interface Session
      Overrides:
      getProjection in class BaseSession
    • authenticate

      public boolean authenticate(String username, String password)
      Description copied from interface: Session
      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.
      Returns:
      true is the credentials match those stored in the directory
    • isAuthenticating

      public boolean isAuthenticating()
      Description copied from interface: Session
      Tells whether the directory implementation can be used as an authenticating backend for the UserManager (based on login / password check).
      Specified by:
      isAuthenticating in interface Session
      Overrides:
      isAuthenticating in class BaseSession
      Returns:
      true is the directory is authentication aware
    • hasEntry

      public boolean hasEntry(String id)
      Description copied from interface: Session
      Returns true if session has an entry with given id.