public class MongoDBSession extends BaseSession
Session| Modifier and Type | Field and Description |
|---|---|
protected com.mongodb.MongoClient |
client |
protected String |
countersCollectionName |
protected String |
dbName |
autoincrementId, directory, directoryName, MULTI_TENANT_ID_FORMAT, passwordHashAlgorithm, permissions, POWER_USERS_GROUP, readAllColumns, READONLY_ENTRY_FLAG, referenceClass, schemaFieldMap, schemaName, substringMatchType| Constructor and Description |
|---|
MongoDBSession(MongoDBDirectory directory) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addField(org.bson.Document bson,
String key,
Object value) |
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) |
void |
close()
Closes the session and all open result sets obtained from this session.
|
protected DocumentModel |
createEntryWithoutReferences(Map<String,Object> fieldMap)
To be implemented for specific creation.
|
void |
deleteEntryWithoutReferences(String id)
To be implemented for specific deletion.
|
protected DocumentModel |
fieldMapToDocumentModel(Map<String,Object> fieldMap) |
com.mongodb.client.MongoCollection<org.bson.Document> |
getCollection()
Retrieve the collection associated to this directory
|
com.mongodb.client.MongoCollection<org.bson.Document> |
getCollection(String collection)
Retrieve a collection
|
MongoDBDirectory |
getDirectory()
To be implemented with a more specific return type.
|
boolean |
hasCollection(String collection)
Check if the MongoDB server has the collection
|
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).
|
DocumentModelList |
query(Map<String,Serializable> filter,
Set<String> fulltext,
Map<String,String> orderBy,
boolean fetchReferences)
Executes a query with the possibility to fetch references
|
DocumentModelList |
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.
|
protected List<String> |
updateEntryWithoutReferences(DocumentModel docModel)
To be implemented for specific update.
|
checkDeleteConstraints, checkPermission, computeMultiTenantDirectoryId, createEntry, createEntry, createEntryModel, createEntryModel, deleteEntry, deleteEntry, deleteEntry, getEntries, getEntry, getEntry, getEntryFromSource, getIdField, getPasswordField, getProjection, getProjection, hasPermission, hasPermission, isReadOnly, isReadOnlyEntry, query, query, query, setReadAllColumns, setReadOnlyEntry, setReadWriteEntry, updateEntryprotected com.mongodb.MongoClient client
protected String countersCollectionName
public MongoDBSession(MongoDBDirectory directory)
public MongoDBDirectory getDirectory()
BaseSessiongetDirectory in class BaseSessionprotected DocumentModel createEntryWithoutReferences(Map<String,Object> fieldMap)
BaseSessioncreateEntryWithoutReferences in class BaseSessionprotected List<String> updateEntryWithoutReferences(DocumentModel docModel) throws DirectoryException
BaseSessionupdateEntryWithoutReferences in class BaseSessionDirectoryExceptionpublic void deleteEntryWithoutReferences(String id) throws DirectoryException
BaseSessiondeleteEntryWithoutReferences in class BaseSessionDirectoryExceptionpublic DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences) throws DirectoryException
Sessionquery in interface Sessionquery in class BaseSessionDirectoryExceptionSession.query(Map, Set, Map)public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences, int limit, int offset) throws DirectoryException
Sessionquery in interface Sessionquery in class BaseSessionlimit - maximum number of results ignored if less than 1offset - number of rows skipped before starting, will be 0 if less than 0.DirectoryExceptionSession.query(Map, Set, Map, boolean)protected org.bson.Document buildQuery(Map<String,Serializable> fieldMap, Set<String> fulltext)
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?
DirectoryException - if a communication error occurspublic boolean authenticate(String username, String password) throws DirectoryException
SessionDirectoryExceptionpublic boolean isAuthenticating()
SessionisAuthenticating in interface SessionisAuthenticating in class BaseSessionpublic boolean hasEntry(String id)
Sessionpublic com.mongodb.client.MongoCollection<org.bson.Document> getCollection(String collection)
collection - the collection namepublic com.mongodb.client.MongoCollection<org.bson.Document> getCollection()
public boolean hasCollection(String collection)
collection - the collection nameprotected DocumentModel fieldMapToDocumentModel(Map<String,Object> fieldMap)
Copyright © 2017 Nuxeo. All rights reserved.