Package org.nuxeo.directory.mongodb
Class MongoDBSession
java.lang.Object
org.nuxeo.ecm.directory.BaseSession
org.nuxeo.directory.mongodb.MongoDBSession
- All Implemented Interfaces:
AutoCloseable
,EntrySource
,Session
MongoDB implementation of a
Session
- Since:
- 9.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
MongoDB Query Builder that knows how to resolved directory properties.Nested classes/interfaces inherited from class org.nuxeo.ecm.directory.BaseSession
BaseSession.FieldDetector
-
Field Summary
Fields inherited from class org.nuxeo.ecm.directory.BaseSession
autoincrementId, computeMultiTenantId, directory, directoryName, MULTI_TENANT_ID_FORMAT, passwordHashAlgorithm, permissions, POWER_USERS_GROUP, readAllColumns, READONLY_ENTRY_FLAG, referenceClass, schemaName, substringMatchType, TENANT_ID_FIELD
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
boolean
authenticate
(String username, String password) Checks that the credentials provided by the UserManager match those registered in the directory.protected org.bson.Document
buildQuery
(Map<String, Serializable> fieldMap, Set<String> fulltext) protected boolean
checkEntryTenantId
(String entryTenantId) void
close()
Closes the session and all open result sets obtained from this session.protected Object
convertToType
(Object value, Type type) protected DocumentModel
createEntryWithoutReferences
(Map<String, Object> fieldMap) Creates an entry to the directory without creating its references.protected DocumentModel
doCreateEntryWithoutReferences
(Map<String, Object> fieldMap) To be implemented for specific creation.void
doDeleteEntryWithoutReferences
(String entryId) To be implemented for specific deletion.protected DocumentModelList
doQuery
(Map<String, Serializable> filter, Set<String> fulltext, Map<String, String> orderBy, boolean fetchReferences, int limit, int offset, boolean checkTenantId) protected DocumentModelList
doQuery
(DirectoryQueryBuilder queryBuilder) To be implemented for specific querying.doQueryIds
(DirectoryQueryBuilder queryBuilder) To be implemented for specific querying.doUpdateEntryWithoutReferences
(DocumentModel docModel) To be implemented for specific update.protected DocumentModel
fieldMapToDocumentModel
(Map<String, Object> fieldMap) protected com.mongodb.client.MongoCollection<org.bson.Document>
Retrieve the collection associated to this directoryprotected com.mongodb.client.MongoCollection<org.bson.Document>
Retrieve the counters collection associated to this directoryTo be implemented with a more specific return type.protected Type
protected String
getIdFromState
(State state) protected String
boolean
Returns true if session has an entry with given id.boolean
Tells whether the directory implementation can be used as an authenticating backend for the UserManager (based on login / password check).query
(Map<String, Serializable> filter, Set<String> fulltext, Map<String, String> orderBy, boolean fetchReferences, int limit, int offset) 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.Methods inherited from class org.nuxeo.ecm.directory.BaseSession
addTenantId, applyQueryLimits, applyQueryLimits, canDeleteMultiTenantEntry, canDeleteMultiTenantEntry, checkDeleteConstraints, checkPermission, computeMultiTenantDirectoryId, createEntry, createEntry, createEntryModel, createEntryModel, createEntryModel, createEntryModel, createEntryModel, createEntryModel, createQueryBuilderForIds, createQueryBuilderWithConfiguredFiltering, createQueryBuilderWithConfiguredFiltering, deleteEntry, deleteEntry, deleteEntryWithoutReferences, getCurrentTenantId, getEntry, getEntryFromSource, getIdField, getPasswordField, getPrefixedFieldName, getPrefixedIdField, getProjection, getProjection, hasPermission, hasPermission, isMultiTenant, isReadOnly, isReadOnlyEntry, query, query, query, query, query, query, queryIds, setReadAllColumns, setReadOnlyEntry, setReadWriteEntry, toStringList, updateEntry, updateEntryWithoutReferences
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.ecm.directory.Session
createEntryModel, getEntry
-
Constructor Details
-
MongoDBSession
-
-
Method Details
-
getDirectory
Description copied from class:BaseSession
To be implemented with a more specific return type.- Specified by:
getDirectory
in classBaseSession
-
createEntryWithoutReferences
Description copied from class:BaseSession
Creates an entry to the directory without creating its references.- Overrides:
createEntryWithoutReferences
in classBaseSession
-
doCreateEntryWithoutReferences
Description copied from class:BaseSession
To be implemented for specific creation.- Overrides:
doCreateEntryWithoutReferences
in classBaseSession
-
convertToType
-
doUpdateEntryWithoutReferences
Description copied from class:BaseSession
To be implemented for specific update.- Overrides:
doUpdateEntryWithoutReferences
in classBaseSession
-
doDeleteEntryWithoutReferences
Description copied from class:BaseSession
To be implemented for specific deletion.- Overrides:
doDeleteEntryWithoutReferences
in classBaseSession
-
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 1offset
- 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
-
addField
-
doQuery
Description copied from class:BaseSession
To be implemented for specific querying.- Overrides:
doQuery
in classBaseSession
- See Also:
-
doQueryIds
Description copied from class:BaseSession
To be implemented for specific querying.- Overrides:
doQueryIds
in classBaseSession
- 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
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 interfaceSession
- Overrides:
isAuthenticating
in classBaseSession
- Returns:
- true is the directory is authentication aware
-
hasEntry
Description copied from interface:Session
Returns true if session has an entry with given id.- Specified by:
hasEntry
in interfaceSession
- Overrides:
hasEntry
in classBaseSession
-
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
-
getIdFromState
-
checkEntryTenantId
-
getPrefixedPasswordField
-
getIdFieldType
-