public class SQLSession extends BaseSession
| Modifier and Type | Field and Description |
|---|---|
protected JDBCLogger |
logger |
protected SQLStaticFilter[] |
staticFilters |
autoincrementId, directory, directoryName, MULTI_TENANT_ID_FORMAT, passwordHashAlgorithm, permissions, POWER_USERS_GROUP, readAllColumns, READONLY_ENTRY_FLAG, referenceClass, schemaName, substringMatchType| Constructor and Description |
|---|
SQLSession(SQLDirectory directory,
SQLDirectoryDescriptor config) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addFilterValues(PreparedStatement ps,
int startIdx) |
protected void |
addFilterValuesForLog(List<Serializable> values) |
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.
|
protected boolean |
canDeleteMultiTenantEntry(String entryId) |
protected void |
checkConcurrentUpdate(Throwable e)
Checks the SQL error we got and determine if a concurrent update happened.
|
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 |
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.
|
void |
deleteEntryWithoutReferences(String id)
To be implemented for specific deletion.
|
protected DocumentModel |
fieldMapToDocumentModel(Map<String,Object> fieldMap) |
protected Serializable |
fieldValueForWrite(Object value,
Column column) |
protected void |
fillPreparedStatementFields(Map<String,Object> filterMap,
List<Column> orderedColumns,
PreparedStatement ps) |
protected String |
getCurrentTenantId()
Returns the tenant id of the logged user if any,
null otherwise. |
SQLDirectory |
getDirectory()
To be implemented with a more specific return type.
|
DocumentModel |
getEntryFromSource(String id,
boolean fetchReferences) |
protected String |
getPassword(String id)
Internal method to read the hashed password for authentication.
|
protected List<Column> |
getReadColumns() |
protected String |
getReadColumnsSQL() |
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 |
isLive()
Enable connection status checking on SQL directory connections
|
protected boolean |
isMultiTenant()
Returns
true if this directory supports multi tenancy, false otherwise. |
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.
|
String |
toString() |
protected List<String> |
updateEntryWithoutReferences(DocumentModel docModel)
To be implemented for specific update.
|
checkDeleteConstraints, checkPermission, computeMultiTenantDirectoryId, createEntry, createEntry, createEntryModel, createEntryModel, deleteEntry, getEntries, getEntry, getEntry, getIdField, getPasswordField, getProjection, getProjection, hasPermission, hasPermission, isReadOnly, isReadOnlyEntry, query, query, query, setReadAllColumns, setReadOnlyEntry, setReadWriteEntry, updateEntryprotected SQLStaticFilter[] staticFilters
protected JDBCLogger logger
public SQLSession(SQLDirectory directory, SQLDirectoryDescriptor config) throws DirectoryException
DirectoryExceptionpublic SQLDirectory getDirectory()
BaseSessiongetDirectory in class BaseSessionpublic DocumentModel getEntryFromSource(String id, boolean fetchReferences) throws DirectoryException
getEntryFromSource in interface EntrySourcegetEntryFromSource in class BaseSessionDirectoryExceptionprotected List<Column> getReadColumns()
protected String getReadColumnsSQL()
protected DocumentModel fieldMapToDocumentModel(Map<String,Object> fieldMap)
protected void checkConcurrentUpdate(Throwable e) throws ConcurrentUpdateException
e - the exceptionConcurrentUpdateExceptionprotected String addFilterWhereClause(String whereClause) throws DirectoryException
DirectoryExceptionprotected void addFilterValues(PreparedStatement ps, int startIdx) throws DirectoryException
DirectoryExceptionprotected void addFilterValuesForLog(List<Serializable> values)
protected String getPassword(String id)
public void deleteEntry(String id)
SessiondeleteEntry in interface SessiondeleteEntry in class BaseSessionid - the id of the entry to deleteprotected boolean canDeleteMultiTenantEntry(String entryId) throws DirectoryException
DirectoryExceptionpublic 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 SessiondeleteEntry in class BaseSessionid - the id of the entry to delete.map - a map of secondary key values.DirectoryException - if a communication error occurs.public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences)
Sessionquery in interface Sessionquery in class BaseSessionSession.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 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 BaseSessionDirectoryExceptionprotected void fillPreparedStatementFields(Map<String,Object> filterMap, List<Column> orderedColumns, PreparedStatement ps) throws DirectoryException
DirectoryExceptionprotected Serializable fieldValueForWrite(Object value, Column column)
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 isLive() throws DirectoryException
DirectoryExceptionpublic boolean authenticate(String username, String password)
Sessionpublic boolean isAuthenticating()
SessionisAuthenticating in interface SessionisAuthenticating in class BaseSessionpublic boolean hasEntry(String id)
Sessionprotected boolean isMultiTenant()
true if this directory supports multi tenancy, false otherwise.protected String getCurrentTenantId()
null otherwise.Copyright © 2018 Nuxeo. All rights reserved.