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, wait
activeSession, 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, updateSessionUserIP
protected 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)
SqlAction
createInsertTrigger
in interface SqlAction
public java.lang.String rewriteHql(java.lang.String query, java.lang.String key, java.lang.Object value)
SqlAction
rewriteHql
in interface SqlAction
query
- 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)
SqlAction
createIdsTempTable
in interface SqlAction
public int closeNodeSessions(java.lang.String uuid)
closeNodeSessions
in interface SqlAction
public int closeNode(java.lang.String uuid)
public boolean setUserPassword(java.lang.Long experimenterID, java.lang.String password)
setUserPassword
in interface SqlAction
public int changeGroupPermissions(java.lang.Long id, java.lang.Long internal)
changeGroupPermissions
in interface SqlAction
public int changeTablePermissionsForGroup(java.lang.String table, java.lang.Long id, java.lang.Long internal)
changeTablePermissionsForGroup
in interface SqlAction
public boolean setPermissionsBit(java.lang.String table, long id, int bit)
SqlAction
1
. 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 SqlAction
table
- 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)
SqlAction
0
. 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 SqlAction
table
- 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)
SqlAction
public java.util.Collection<java.lang.Long> findOldAdminPrivileges()
SqlAction
findOldAdminPrivileges
in interface SqlAction
public void deleteOldAdminPrivileges(java.util.Collection<java.lang.Long> transactionIds)
SqlAction
deleteOldAdminPrivileges
in interface SqlAction
transactionIds
- the transaction IDs to deletepublic void deleteCurrentAdminPrivileges()
SqlAction
deleteCurrentAdminPrivileges
in interface SqlAction
public void insertCurrentAdminPrivileges(java.lang.Iterable<AdminPrivilege> privileges)
SqlAction
insertCurrentAdminPrivileges
in interface SqlAction
privileges
- 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)
SqlAction
SqlAction.findRepoFile(String, String, String, Set)
passing null.findRepoFile
in interface SqlAction
public java.lang.Long findRepoFile(java.lang.String uuid, java.lang.String dirname, java.lang.String basename, java.lang.String mimetype)
SqlAction
findRepoFile
in interface SqlAction
public java.lang.Long findRepoFile(java.lang.String uuid, java.lang.String dirname, java.lang.String basename, java.util.Set<java.lang.String> mimetypes)
SqlAction
OriginalFile
in a given
repository or return null if none is found.findRepoFile
in interface SqlAction
uuid
- 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)
SqlAction
SqlAction.findRepoFile(String, String, String, Set)
, but queries in
bulk and returns a map for the found IDs.findRepoFiles
in interface SqlAction
public int repoScriptCount(java.lang.String uuid, java.util.Set<java.lang.String> mimetypes)
repoScriptCount
in interface SqlAction
uuid
- 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 SqlAction
uuid
- 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)
SqlAction
fileIdsInDb
in interface SqlAction
public java.util.List<java.lang.Long> filterFileIdsByRepo(java.lang.String uuid, java.util.List<java.lang.Long> fileIds)
SqlAction
filterFileIdsByRepo
in interface SqlAction
uuid
- a repository UUIDfileIds
- IDs of original filespublic java.util.List<java.lang.Long> findRepoFiles(java.lang.String uuid, java.lang.String dirname)
SqlAction
findRepoFiles
in interface SqlAction
public java.util.List<SqlAction.DeleteLog> findRepoDeleteLogs(SqlAction.DeleteLog template)
SqlAction
SqlAction.DeleteLog
entries which match all of the non-null
fields provided in the template.findRepoDeleteLogs
in interface SqlAction
template
- non-null.SqlAction.DeleteLog
entriespublic int deleteRepoDeleteLogs(SqlAction.DeleteLog template)
SqlAction
SqlAction.DeleteLog
entries which match all of the non-null
fields provided in the template.deleteRepoDeleteLogs
in interface SqlAction
template
- not-nullpublic java.lang.String findRepoRootPath(java.lang.String uuid)
SqlAction
findRepoRootPath
in interface SqlAction
uuid
- a repository UUIDpublic java.lang.String findRepoFilePath(java.lang.String uuid, long id)
findRepoFilePath
in interface SqlAction
public java.util.List<long[]> nextPixelsDataLogForRepo(java.lang.String repo, long lastEventId, int rows)
SqlAction
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. Multiple eventlogs are returned
per user in order to support multi-threading. Duplicate pixel ids
are stripped.nextPixelsDataLogForRepo
in interface SqlAction
public long getGroupPermissions(long groupId)
SqlAction
getGroupPermissions
in interface SqlAction
public java.util.Map<java.lang.String,java.lang.Long> getGroupIds(java.util.Collection<java.lang.String> names)
getGroupIds
in interface SqlAction
public java.lang.String getPasswordHash(java.lang.Long experimenterID)
getPasswordHash
in interface SqlAction
public java.lang.Long getUserId(java.lang.String userName)
SqlAction
public java.lang.String getUserPrettyNameByOmeName(java.lang.String userName)
SqlAction
getUserPrettyNameByOmeName
in interface SqlAction
userName
- a user's OME namenull
if their OME name does not existpublic java.lang.String getUserEmailByOmeName(java.lang.String userName)
SqlAction
getUserEmailByOmeName
in interface SqlAction
userName
- 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)
SqlAction
getUserEmailsByGroup
in interface SqlAction
Collection
of non-empty user email addresses.public java.lang.String getUsername(long userId)
SqlAction
getUsername
in interface SqlAction
userId
- the user's IDnull
if they cannot be foundpublic java.util.List<java.lang.Long> getLdapExperimenters()
SqlAction
ldap
attribute enabled.getLdapExperimenters
in interface SqlAction
public boolean isLdapExperimenter(java.lang.Long id)
SqlAction
ldap
flag set.isLdapExperimenter
in interface SqlAction
id
- The experimenter ID.public java.util.List<java.lang.String> getUserGroups(java.lang.String userName)
getUserGroups
in interface SqlAction
public ExperimenterGroup groupInfoFor(java.lang.String table, long id)
SqlAction
ExperimenterGroup
object containing
only the id, name, and permissions.groupInfoFor
in interface SqlAction
public java.lang.String fileRepo(long fileId)
public java.lang.String scriptRepo(long fileId, java.util.Set<java.lang.String> mimetypes)
SqlAction
SqlAction.fileRepo(long)
, but only returns values for files
which are also scripts. Null may be returnedscriptRepo
in interface SqlAction
mimetypes
- null implies all files are checkedpublic long setStatsInfo(Channel ch, StatsInfo si)
setStatsInfo
in interface SqlAction
public java.lang.String configValue(java.lang.String key)
configValue
in interface SqlAction
public int delConfigValue(java.lang.String key)
delConfigValue
in interface SqlAction
public int updateOrInsertConfigValue(java.lang.String name, java.lang.String value)
updateOrInsertConfigValue
in interface SqlAction
public long selectCurrentEventLog(java.lang.String key)
selectCurrentEventLog
in interface SqlAction
public float getEventLogPercent(java.lang.String key)
SqlAction
getEventLogPercent
in interface SqlAction
key
- 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)
SqlAction
getEventLogPartitions
in interface SqlAction
types
- 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 SqlAction
public void delCurrentEventLog(java.lang.String key)
delCurrentEventLog
in interface SqlAction
public void refreshEventLogFromUpdatedAnnotations()
SqlAction
refreshEventLogFromUpdatedAnnotations
in interface SqlAction
public boolean hasUnicodeUnits()
hasUnicodeUnits
in interface SqlAction
public void addMessageWithinDbPatchStart(java.lang.String version, int patch, java.lang.String message)
SqlAction
addMessageWithinDbPatchStart
in interface SqlAction
version
- 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)
SqlAction
addMessageWithinDbPatchEnd
in interface SqlAction
version
- 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)
SqlAction
getShareData
in interface SqlAction
ids
- IDs of Shares for which data blobs are to be returned.