public class SQLSession extends BaseSession
BaseSession.FieldDetector| Modifier and Type | Field and Description |
|---|---|
protected Dialect |
dialect |
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) |
protected void |
addFilterWhereClause(StringBuilder clause,
List<SQLQueryBuilder.ColumnAndValue> params) |
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 Column |
getIdColumn() |
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.
|
DocumentModelList |
query(QueryBuilder queryBuilder,
boolean fetchReferences)
Executes a query with the possibility to fetch a subset of the results.
|
List<String> |
queryIds(QueryBuilder queryBuilder)
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.
|
addTenantId, applyQueryLimits, 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, toStringList, updateEntryprotected SQLStaticFilter[] staticFilters
protected JDBCLogger logger
public SQLSession(SQLDirectory directory, SQLDirectoryDescriptor config)
public SQLDirectory getDirectory()
BaseSessiongetDirectory in class BaseSessionpublic DocumentModel getEntryFromSource(String id, boolean fetchReferences)
getEntryFromSource in interface EntrySourcegetEntryFromSource in class BaseSessionprotected List<Column> getReadColumns()
protected String getReadColumnsSQL()
protected Column getIdColumn()
protected DocumentModel fieldMapToDocumentModel(Map<String,Object> fieldMap)
protected void checkConcurrentUpdate(Throwable e) throws ConcurrentUpdateException
e - the exceptionConcurrentUpdateExceptionprotected String addFilterWhereClause(String whereClause)
protected void addFilterWhereClause(StringBuilder clause, List<SQLQueryBuilder.ColumnAndValue> params)
protected void addFilterValues(PreparedStatement ps, int startIdx)
protected 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)
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.public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences, int limit, int offset)
Sessionlimit - maximum number of results ignored if less than 1offset - number of rows skipped before starting, will be 0 if less than 0.Session.query(Map, Set, Map, boolean)public DocumentModelList query(QueryBuilder queryBuilder, boolean fetchReferences)
SessionqueryBuilder - the query to use, including limit, offset, ordering and countTotalfetchReferences - boolean stating if references have to be fetchedpublic List<String> queryIds(QueryBuilder queryBuilder)
SessionqueryBuilder - the query to use, including limit, offset and orderingprotected 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)
BaseSessionupdateEntryWithoutReferences in class BaseSessionpublic void deleteEntryWithoutReferences(String id)
BaseSessiondeleteEntryWithoutReferences in class BaseSessionprotected void fillPreparedStatementFields(Map<String,Object> filterMap, List<Column> orderedColumns, PreparedStatement ps)
protected Serializable fieldValueForWrite(Object value, Column column)
public void close()
SessionReleases this Connection object's resources immediately instead of waiting for them to be automatically released.
TODO: should this operation auto-commit pending changes?
public boolean isLive()
public boolean authenticate(String username, String password)
Sessionpublic boolean isAuthenticating()
SessionisAuthenticating in interface SessionisAuthenticating in class BaseSessionpublic boolean hasEntry(String id)
SessionCopyright © 2019 Nuxeo. All rights reserved.