public abstract static class SqlAction.Impl extends java.lang.Object implements SqlAction
SqlAction.DeleteLog, SqlAction.IdRowMapper, SqlAction.Impl, SqlAction.LoggingSqlAction, SqlAction.StringRowMapper| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
log |
protected static int |
MAX_IN_SIZE |
| Constructor and Description |
|---|
Impl() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract org.springframework.jdbc.core.JdbcTemplate |
_jdbc() |
protected abstract java.lang.String |
_lookup(java.lang.String key) |
protected abstract org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate |
_namedJdbc() |
void |
addMessageWithinDbPatchEnd(java.lang.String version,
int patch,
java.lang.String message)
Add a unique message to the DB patch table within the current patch.
|
void |
addMessageWithinDbPatchStart(java.lang.String version,
int patch,
java.lang.String message)
Add a unique message to the DB patch table within the current patch.
|
protected java.lang.String |
addMimetypes(java.util.Collection<java.lang.String> mimetypes,
org.springframework.jdbc.core.namedparam.MapSqlParameterSource params)
Returns the "and_mimetype" clause which must be appended to a given
query.
|
int |
changeGroupPermissions(java.lang.Long id,
java.lang.Long internal) |
int |
changeTablePermissionsForGroup(java.lang.String table,
java.lang.Long id,
java.lang.Long internal) |
boolean |
clearPermissionsBit(java.lang.String table,
long id,
int bit)
Sets the given permissions bit to
0. |
int |
closeNode(java.lang.String uuid) |
int |
closeNodeSessions(java.lang.String uuid) |
java.lang.String |
configValue(java.lang.String key) |
java.lang.String |
createIdsTempTable(java.util.Collection<java.lang.Long> ids)
Creates a temporary table filled with the given ids and returns its
name.
|
void |
createInsertTrigger(java.lang.String name,
java.lang.String table,
java.lang.String procedure)
Creates an insert trigger of the given name, for the given table,
with the given procedure.
|
int |
delConfigValue(java.lang.String key) |
void |
delCurrentEventLog(java.lang.String key) |
void |
deleteCurrentAdminPrivileges()
Delete the current light administrator privileges for the current transaction.
|
void |
deleteOldAdminPrivileges(java.util.Collection<java.lang.Long> transactionIds)
Delete the current light administrator privileges for the given transactions.
|
int |
deleteRepoDeleteLogs(SqlAction.DeleteLog template)
Delete all
SqlAction.DeleteLog entries which match all of the non-null
fields provided in the template. |
java.util.List<java.lang.Long> |
fileIdsInDb(java.lang.String uuid,
java.util.Set<java.lang.String> mimetypes)
Return all IDs matching the given mimetypes, or all IDs if mimetypes is null.
|
java.lang.String |
fileRepo(long fileId) |
java.util.List<java.lang.Long> |
filterFileIdsByRepo(java.lang.String uuid,
java.util.List<java.lang.Long> fileIds)
Find the original file IDs among those given that are in the given repository.
|
java.util.Collection<java.lang.Long> |
findOldAdminPrivileges()
Find the completed transactions among the current light administrator privileges.
|
java.util.List<SqlAction.DeleteLog> |
findRepoDeleteLogs(SqlAction.DeleteLog template)
Find all
SqlAction.DeleteLog entries which match all of the non-null
fields provided in the template. |
java.lang.Long |
findRepoFile(java.lang.String uuid,
java.lang.String dirname,
java.lang.String basename)
Calls
SqlAction.findRepoFile(String, String, String, Set)
passing null. |
java.lang.Long |
findRepoFile(java.lang.String uuid,
java.lang.String dirname,
java.lang.String basename,
java.util.Set<java.lang.String> mimetypes)
Lookup the id of an
OriginalFile in a given
repository or return null if none is found. |
java.lang.Long |
findRepoFile(java.lang.String uuid,
java.lang.String dirname,
java.lang.String basename,
java.lang.String mimetype)
|
java.lang.String |
findRepoFilePath(java.lang.String uuid,
long id) |
java.util.List<java.lang.Long> |
findRepoFiles(java.lang.String uuid,
java.lang.String dirname)
Return a list of original file ids that all have a path value matching
the passed dirname in the given repository.
|
java.util.Map<java.lang.String,java.lang.Long> |
findRepoFiles(java.lang.String uuid,
java.lang.String dirname,
java.util.List<java.lang.String> basenames,
java.util.Set<java.lang.String> mimetypes)
Like
SqlAction.findRepoFile(String, String, String, Set), but queries in
bulk and returns a map for the found IDs. |
java.lang.String |
findRepoRootPath(java.lang.String uuid)
Find the path of the repository root.
|
java.util.List<java.lang.Object[]> |
getEventLogPartitions(java.util.Collection<java.lang.String> types,
java.util.Collection<java.lang.String> actions,
long offset,
long limit)
Loads up to "limit" event logs using partioning so that only the
last event log of a particular (type, id) pair is returned.
|
float |
getEventLogPercent(java.lang.String key)
Returns the percent (e.g.
|
java.util.Map<java.lang.String,java.lang.Long> |
getGroupIds(java.util.Collection<java.lang.String> names) |
long |
getGroupPermissions(long groupId)
Returns the permissions for the given group id.
|
java.util.List<java.lang.Long> |
getLdapExperimenters()
Gets the experimenters who have the
ldap attribute enabled. |
java.lang.String |
getPasswordHash(java.lang.Long experimenterID) |
java.util.Map<java.lang.Long,byte[]> |
getShareData(java.util.List<java.lang.Long> ids)
Returns a map of Share ID to Share data blob.
|
java.lang.String |
getUserEmailByOmeName(java.lang.String userName)
Load the email address for the given user.
|
java.util.Collection<java.lang.String> |
getUserEmailsByGroup(long groupId)
Load all the non-empty email addresses for users in a given group.
|
java.util.List<java.lang.String> |
getUserGroups(java.lang.String userName) |
java.lang.Long |
getUserId(java.lang.String userName)
Get the user's ID
|
java.lang.String |
getUsername(long userId)
Get the user's name
|
java.lang.String |
getUserPrettyNameByOmeName(java.lang.String userName)
Load the pretty name for the given user.
|
ExperimenterGroup |
groupInfoFor(java.lang.String table,
long id)
Return a mostly unloaded
ExperimenterGroup object containing
only the id, name, and permissions. |
boolean |
hasUnicodeUnits() |
void |
insertCurrentAdminPrivileges(java.lang.Iterable<AdminPrivilege> privileges)
Insert the current light administrator privileges for the current transaction.
|
int |
isFileInRepo(java.lang.String uuid,
long id,
java.util.Set<java.lang.String> mimetypes) |
boolean |
isLdapExperimenter(java.lang.Long id)
Checks whether the specified experimenter ID has the
ldap
flag set. |
java.util.List<long[]> |
nextPixelsDataLogForRepo(java.lang.String repo,
long lastEventId,
int rows)
Returns arrays of longs for the following SQL return values:
experimenter, eventlog, entityid as pixels, rownumber
The oldest N eventlogs with action = "PIXELDATA" and entitytype = "ome.model.core.Pixels"
is found per user and returned. |
protected java.lang.String |
printThrowable(java.lang.Throwable t) |
void |
refreshEventLogFromUpdatedAnnotations()
Convert the _reindexing_required table to REINDEX entries in the event log.
|
int |
repoScriptCount(java.lang.String uuid,
java.util.Set<java.lang.String> mimetypes) |
java.lang.String |
rewriteHql(java.lang.String query,
java.lang.String key,
java.lang.Object value)
Allows the specific database implementations a chance to modify
queries.
|
java.lang.String |
scriptRepo(long fileId,
java.util.Set<java.lang.String> mimetypes)
Similar to
SqlAction.fileRepo(long), but only returns values for files
which are also scripts. |
long |
selectCurrentEventLog(java.lang.String key) |
void |
setCurrentEventLog(long id,
java.lang.String key) |
boolean |
setPermissionsBit(java.lang.String table,
long id,
int bit)
Sets the given permissions bit to
1. |
void |
setRoles(long rootUserId,
long guestUserId,
long systemGroupId,
long userGroupId,
long guestGroupId)
Note the roles in the database.
|
long |
setStatsInfo(Channel ch,
StatsInfo si) |
boolean |
setUserPassword(java.lang.Long experimenterID,
java.lang.String password) |
int |
updateOrInsertConfigValue(java.lang.String name,
java.lang.String value) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitactiveSession, closeSessions, countFormat, createSavepoint, currentUserNames, currValue, dbUuid, dbVersion, deferConstraints, findRepoImageFromPixels, findRepoPixels, getDeletedIds, getPixelsNamePathRepo, getShapeIds, insertFormat, insertLogs, insertSession, nextSessionId, nextValue, nodeId, now, prepareSession, releaseSavepoint, removePassword, repoFile, roiByImage, rollbackSavepoint, sessionId, setFileRepo, setPixelsNamePathRepo, synchronizeJobs, updateConfiguration, updateSessionUserIPprotected static final int MAX_IN_SIZE
protected final org.slf4j.Logger log
protected abstract org.springframework.jdbc.core.JdbcTemplate _jdbc()
protected abstract org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate _namedJdbc()
protected abstract java.lang.String _lookup(java.lang.String key)
protected java.lang.String printThrowable(java.lang.Throwable t)
public void createInsertTrigger(java.lang.String name,
java.lang.String table,
java.lang.String procedure)
SqlActioncreateInsertTrigger in interface SqlActionpublic java.lang.String rewriteHql(java.lang.String query,
java.lang.String key,
java.lang.Object value)
SqlActionrewriteHql in interface SqlActionquery - String query (non-null) which is in effect.key - Key of the argument e.g. (:ids)value - value which has been passed in for that parameter.public java.lang.String createIdsTempTable(java.util.Collection<java.lang.Long> ids)
SqlActioncreateIdsTempTable in interface SqlActionpublic int closeNodeSessions(java.lang.String uuid)
closeNodeSessions in interface SqlActionpublic int closeNode(java.lang.String uuid)
public boolean setUserPassword(java.lang.Long experimenterID,
java.lang.String password)
setUserPassword in interface SqlActionpublic int changeGroupPermissions(java.lang.Long id,
java.lang.Long internal)
changeGroupPermissions in interface SqlActionpublic int changeTablePermissionsForGroup(java.lang.String table,
java.lang.Long id,
java.lang.Long internal)
changeTablePermissionsForGroup in interface SqlActionpublic boolean setPermissionsBit(java.lang.String table,
long id,
int bit)
SqlAction1. Note: Actually sets the bit to 1 in the value stored in the database,
does not adopt the inverse convention associated with permissions flags.setPermissionsBit in interface SqlActiontable - the table in which to find the rowid - the value of the table's id column that identifies the row to updatebit - the bit number to set to 1, counting from 0 as the least significant bitpublic boolean clearPermissionsBit(java.lang.String table,
long id,
int bit)
SqlAction0. Note: Actually sets the bit to 0 in the value stored in the database,
does not adopt the inverse convention associated with permissions flags.clearPermissionsBit in interface SqlActiontable - the table in which to find the rowid - the value of the table's id column that identifies the row to updatebit - the bit number to set to 0, counting from 0 as the least significant bitpublic void setRoles(long rootUserId,
long guestUserId,
long systemGroupId,
long userGroupId,
long guestGroupId)
SqlActionpublic java.util.Collection<java.lang.Long> findOldAdminPrivileges()
SqlActionfindOldAdminPrivileges in interface SqlActionpublic void deleteOldAdminPrivileges(java.util.Collection<java.lang.Long> transactionIds)
SqlActiondeleteOldAdminPrivileges in interface SqlActiontransactionIds - the transaction IDs to deletepublic void deleteCurrentAdminPrivileges()
SqlActiondeleteCurrentAdminPrivileges in interface SqlActionpublic void insertCurrentAdminPrivileges(java.lang.Iterable<AdminPrivilege> privileges)
SqlActioninsertCurrentAdminPrivileges in interface SqlActionprivileges - some light administrator privilegesprotected java.lang.String addMimetypes(java.util.Collection<java.lang.String> mimetypes,
org.springframework.jdbc.core.namedparam.MapSqlParameterSource params)
mimetypes - If null, then "" will be returned.params - sql parameter source to be passed to JDBC methods.public java.lang.Long findRepoFile(java.lang.String uuid,
java.lang.String dirname,
java.lang.String basename)
SqlActionSqlAction.findRepoFile(String, String, String, Set)
passing null.findRepoFile in interface SqlActionpublic java.lang.Long findRepoFile(java.lang.String uuid,
java.lang.String dirname,
java.lang.String basename,
java.lang.String mimetype)
SqlActionfindRepoFile in interface SqlActionpublic java.lang.Long findRepoFile(java.lang.String uuid,
java.lang.String dirname,
java.lang.String basename,
java.util.Set<java.lang.String> mimetypes)
SqlActionOriginalFile in a given
repository or return null if none is found.findRepoFile in interface SqlActionuuid - The UUID of the repository (originalfile.sha1)dirname - the full directory path minus the file name.basename - i.e. the filename without any directory pathmimetypes - if null, then no mimetype query fragement will be added.OriginalFile is found,
otherwise the id.public java.util.Map<java.lang.String,java.lang.Long> findRepoFiles(java.lang.String uuid,
java.lang.String dirname,
java.util.List<java.lang.String> basenames,
java.util.Set<java.lang.String> mimetypes)
SqlActionSqlAction.findRepoFile(String, String, String, Set), but queries in
bulk and returns a map for the found IDs.findRepoFiles in interface SqlActionpublic int repoScriptCount(java.lang.String uuid,
java.util.Set<java.lang.String> mimetypes)
repoScriptCount in interface SqlActionuuid - repository identifiermimetypes - file mimetypes to check; if null, all files;public int isFileInRepo(java.lang.String uuid,
long id,
java.util.Set<java.lang.String> mimetypes)
isFileInRepo in interface SqlActionuuid - Repository identifierid - file identifiermimetypes - Set of mimetypes to check; if null, all files.public java.util.List<java.lang.Long> fileIdsInDb(java.lang.String uuid,
java.util.Set<java.lang.String> mimetypes)
SqlActionfileIdsInDb in interface SqlActionpublic java.util.List<java.lang.Long> filterFileIdsByRepo(java.lang.String uuid,
java.util.List<java.lang.Long> fileIds)
SqlActionfilterFileIdsByRepo in interface SqlActionuuid - a repository UUIDfileIds - IDs of original filespublic java.util.List<java.lang.Long> findRepoFiles(java.lang.String uuid,
java.lang.String dirname)
SqlActionfindRepoFiles in interface SqlActionpublic java.util.List<SqlAction.DeleteLog> findRepoDeleteLogs(SqlAction.DeleteLog template)
SqlActionSqlAction.DeleteLog entries which match all of the non-null
fields provided in the template.findRepoDeleteLogs in interface SqlActiontemplate - non-null.SqlAction.DeleteLog entriespublic int deleteRepoDeleteLogs(SqlAction.DeleteLog template)
SqlActionSqlAction.DeleteLog entries which match all of the non-null
fields provided in the template.deleteRepoDeleteLogs in interface SqlActiontemplate - not-nullpublic java.lang.String findRepoRootPath(java.lang.String uuid)
SqlActionfindRepoRootPath in interface SqlActionuuid - a repository UUIDpublic java.lang.String findRepoFilePath(java.lang.String uuid,
long id)
findRepoFilePath in interface SqlActionpublic java.util.List<long[]> nextPixelsDataLogForRepo(java.lang.String repo,
long lastEventId,
int rows)
SqlActionexperimenter, eventlog, entityid as pixels, rownumber
The oldest N eventlogs with action = "PIXELDATA" and entitytype = "ome.model.core.Pixels"
is found per user and returned. Multiple eventlogs are returned
per user in order to support multi-threading. Duplicate pixel ids
are stripped.nextPixelsDataLogForRepo in interface SqlActionpublic long getGroupPermissions(long groupId)
SqlActiongetGroupPermissions in interface SqlActionpublic java.util.Map<java.lang.String,java.lang.Long> getGroupIds(java.util.Collection<java.lang.String> names)
getGroupIds in interface SqlActionpublic java.lang.String getPasswordHash(java.lang.Long experimenterID)
getPasswordHash in interface SqlActionpublic java.lang.Long getUserId(java.lang.String userName)
SqlActionpublic java.lang.String getUserPrettyNameByOmeName(java.lang.String userName)
SqlActiongetUserPrettyNameByOmeName in interface SqlActionuserName - a user's OME namenull if their OME name does not existpublic java.lang.String getUserEmailByOmeName(java.lang.String userName)
SqlActiongetUserEmailByOmeName in interface SqlActionuserName - a user's OME namenull if they have none or their OME name does not existpublic java.util.Collection<java.lang.String> getUserEmailsByGroup(long groupId)
SqlActiongetUserEmailsByGroup in interface SqlActionCollection of non-empty user email addresses.public java.lang.String getUsername(long userId)
SqlActiongetUsername in interface SqlActionuserId - the user's IDnull if they cannot be foundpublic java.util.List<java.lang.Long> getLdapExperimenters()
SqlActionldap attribute enabled.getLdapExperimenters in interface SqlActionpublic boolean isLdapExperimenter(java.lang.Long id)
SqlActionldap
flag set.isLdapExperimenter in interface SqlActionid - The experimenter ID.public java.util.List<java.lang.String> getUserGroups(java.lang.String userName)
getUserGroups in interface SqlActionpublic ExperimenterGroup groupInfoFor(java.lang.String table, long id)
SqlActionExperimenterGroup object containing
only the id, name, and permissions.groupInfoFor in interface SqlActionpublic java.lang.String fileRepo(long fileId)
public java.lang.String scriptRepo(long fileId,
java.util.Set<java.lang.String> mimetypes)
SqlActionSqlAction.fileRepo(long), but only returns values for files
which are also scripts. Null may be returnedscriptRepo in interface SqlActionmimetypes - null implies all files are checkedpublic long setStatsInfo(Channel ch, StatsInfo si)
setStatsInfo in interface SqlActionpublic java.lang.String configValue(java.lang.String key)
configValue in interface SqlActionpublic int delConfigValue(java.lang.String key)
delConfigValue in interface SqlActionpublic int updateOrInsertConfigValue(java.lang.String name,
java.lang.String value)
updateOrInsertConfigValue in interface SqlActionpublic long selectCurrentEventLog(java.lang.String key)
selectCurrentEventLog in interface SqlActionpublic float getEventLogPercent(java.lang.String key)
SqlActiongetEventLogPercent in interface SqlActionkey - PersistentEventLogLoader key for lookup in the configuration tablepublic java.util.List<java.lang.Object[]> getEventLogPartitions(java.util.Collection<java.lang.String> types,
java.util.Collection<java.lang.String> actions,
long offset,
long limit)
SqlActiongetEventLogPartitions in interface SqlActiontypes - Collection of entityType strings which should be queriedactions - Collection of ACTION strings which should be queriedoffset - Offset to the row which should be queried firstlimit - Maximum number of rows (after partionting) which should
be returned.public void setCurrentEventLog(long id,
java.lang.String key)
setCurrentEventLog in interface SqlActionpublic void delCurrentEventLog(java.lang.String key)
delCurrentEventLog in interface SqlActionpublic void refreshEventLogFromUpdatedAnnotations()
SqlActionrefreshEventLogFromUpdatedAnnotations in interface SqlActionpublic boolean hasUnicodeUnits()
hasUnicodeUnits in interface SqlActionpublic void addMessageWithinDbPatchStart(java.lang.String version,
int patch,
java.lang.String message)
SqlActionaddMessageWithinDbPatchStart in interface SqlActionversion - the version of the current DBpatch - the patch of the current DBmessage - the new message to notepublic void addMessageWithinDbPatchEnd(java.lang.String version,
int patch,
java.lang.String message)
SqlActionaddMessageWithinDbPatchEnd in interface SqlActionversion - the version of the current DBpatch - the patch of the current DBmessage - the new message to notepublic java.util.Map<java.lang.Long,byte[]> getShareData(java.util.List<java.lang.Long> ids)
SqlActiongetShareData in interface SqlActionids - IDs of Shares for which data blobs are to be returned.