Class MongoDBSession

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

public class MongoDBSession extends BaseSession
MongoDB implementation of a Session
Since:
9.1
  • Constructor Details

  • Method Details

    • getDirectory

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

      protected DocumentModel createEntryWithoutReferences(Map<String,Object> fieldMap)
      Description copied from class: BaseSession
      Creates an entry to the directory without creating its references.
      Overrides:
      createEntryWithoutReferences in class BaseSession
    • doCreateEntryWithoutReferences

      protected DocumentModel doCreateEntryWithoutReferences(Map<String,Object> fieldMap)
      Description copied from class: BaseSession
      To be implemented for specific creation.
      Overrides:
      doCreateEntryWithoutReferences in class BaseSession
    • convertToType

      protected Object convertToType(Object value, Type type)
    • doUpdateEntryWithoutReferences

      protected List<String> doUpdateEntryWithoutReferences(DocumentModel docModel)
      Description copied from class: BaseSession
      To be implemented for specific update.
      Overrides:
      doUpdateEntryWithoutReferences in class BaseSession
    • doDeleteEntryWithoutReferences

      public void doDeleteEntryWithoutReferences(String entryId)
      Description copied from class: BaseSession
      To be implemented for specific deletion.
      Overrides:
      doDeleteEntryWithoutReferences in class BaseSession
    • 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:
    • doQuery

      protected DocumentModelList doQuery(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences, int limit, int offset, boolean checkTenantId)
    • buildQuery

      protected org.bson.Document buildQuery(Map<String,Serializable> fieldMap, Set<String> fulltext)
    • addField

      protected void addField(org.bson.Document bson, String key, Object value)
    • doQuery

      protected DocumentModelList doQuery(DirectoryQueryBuilder queryBuilder)
      Description copied from class: BaseSession
      To be implemented for specific querying.
      Overrides:
      doQuery in class BaseSession
      See Also:
    • doQueryIds

      protected List<String> doQueryIds(DirectoryQueryBuilder queryBuilder)
      Description copied from class: BaseSession
      To be implemented for specific querying.
      Overrides:
      doQueryIds in class BaseSession
      See Also:
    • 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?

    • 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 idOrSysId)
      Description copied from interface: Session
      Returns true if session has an entry with given id.
      Specified by:
      hasEntry in interface Session
      Overrides:
      hasEntry in class BaseSession
    • getCollection

      protected com.mongodb.client.MongoCollection<org.bson.Document> getCollection()
      Retrieve the collection associated to this directory
      Returns:
      the MongoDB collection
    • getCountersCollection

      protected com.mongodb.client.MongoCollection<org.bson.Document> getCountersCollection()
      Retrieve the counters collection associated to this directory
      Returns:
      the MongoDB counters collection
    • fieldMapToDocumentModel

      protected DocumentModel fieldMapToDocumentModel(Map<String,Object> fieldMap)
    • getIdFromState

      protected String getIdFromState(State state)
    • checkEntryTenantId

      protected boolean checkEntryTenantId(String entryTenantId)
    • getPrefixedPasswordField

      protected String getPrefixedPasswordField()
    • getIdFieldType

      protected Type getIdFieldType()