public class SQLSession extends BaseSession
| Modifier and Type | Field and Description |
|---|---|
protected JDBCLogger |
logger |
protected SQLStaticFilter[] |
staticFilters |
autoincrementId, computeMultiTenantId, directory, directoryName, MULTI_TENANT_ID_FORMAT, passwordHashAlgorithm, permissions, POWER_USERS_GROUP, readAllColumns, READONLY_ENTRY_FLAG, referenceClass, schemaName, substringMatchType, TENANT_ID_FIELD| 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 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) |
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 PreparedStatement |
prepareStatementWithAutoKeys(String sql)
Create a
PreparedStatement returning the id key if it is auto-incremented and dialect has identity
generated key (Dialect.hasIdentityGeneratedKey(). |
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 void |
setIdFieldInMap(ResultSet rs,
Column column,
String idFieldName,
Map<String,Object> fieldMap) |
String |
toString() |
protected List<String> |
updateEntryWithoutReferences(DocumentModel docModel)
To be implemented for specific update.
|
applyQueryLimits, canDeleteMultiTenantEntry, checkDeleteConstraints, checkPermission, computeMultiTenantDirectoryId, createEntry, createEntry, createEntryModel, createEntryModel, deleteEntry, getCurrentTenantId, getEntries, getEntry, getEntry, getIdField, getPasswordField, getProjection, getProjection, hasPermission, hasPermission, isMultiTenant, isReadOnly, isReadOnlyEntry, query, 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 deletepublic 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, int limit, int offset) throws DirectoryException
Sessionlimit - 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 void setIdFieldInMap(ResultSet rs, Column column, String idFieldName, Map<String,Object> fieldMap) throws SQLException
SQLExceptionprotected PreparedStatement prepareStatementWithAutoKeys(String sql) throws SQLException
PreparedStatement returning the id key if it is auto-incremented and dialect has identity
generated key (Dialect.hasIdentityGeneratedKey().SQLExceptionprotected 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)
SessionCopyright © 2018 Nuxeo. All rights reserved.