public interface SqlAction
This interface is meant to replace all uses of both
JdbcTemplate
and
Session.createSQLQuery(String)
for the entire OMERO
code base.
Modifier and Type | Interface and Description |
---|---|
static class |
SqlAction.DeleteLog
Record-class which matches _fs_deletelog.
|
static class |
SqlAction.IdRowMapper |
static class |
SqlAction.Impl
Base implementation which can be used
|
static class |
SqlAction.LoggingSqlAction |
static class |
SqlAction.StringRowMapper |
Modifier and Type | Method and Description |
---|---|
boolean |
activeSession(java.lang.String sessionUUID)
Returns whether the given string is the UUID of a session that is
currently active.
|
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.
|
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) |
int |
closeSessions(java.lang.String uuid) |
java.lang.String |
configValue(java.lang.String name) |
long |
countFormat(java.lang.String name) |
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.
|
void |
createSavepoint(java.lang.String savepoint) |
java.util.Set<java.lang.String> |
currentUserNames() |
long |
currValue(java.lang.String segmentName) |
java.lang.String |
dbUuid() |
java.lang.String |
dbVersion() |
void |
deferConstraints() |
int |
delConfigValue(java.lang.String name) |
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
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 repoUuid,
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
findRepoFile(String, String, String, Set) , but queries in
bulk and returns a map for the found IDs. |
java.lang.Long |
findRepoImageFromPixels(long id) |
java.util.List<java.lang.Long> |
findRepoPixels(java.lang.String uuid,
java.lang.String dirname,
java.lang.String basename) |
java.lang.String |
findRepoRootPath(java.lang.String uuid)
Find the path of the repository root.
|
java.util.List<java.lang.Long> |
getDeletedIds(java.lang.String entityType) |
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 id)
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.List<java.lang.String> |
getPixelsNamePathRepo(long id)
Retrieves the name, path and repo for the given pixels set.
|
java.util.List<java.lang.Long> |
getShapeIds(long roiId) |
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.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
|
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 |
insertFormat(java.lang.String name)
Deprecated.
|
void |
insertLogs(java.util.List<java.lang.Object[]> batchData) |
int |
insertSession(java.util.Map<java.lang.String,java.lang.Object> params) |
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 howmany)
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. |
java.lang.Long |
nextSessionId() |
long |
nextValue(java.lang.String segmentName,
int incrementSize)
The implementation of this method guarantees that even if the current
transaction fails that the value found will not be used by another
transaction.
|
long |
nodeId(java.lang.String internal_uuid) |
java.util.Date |
now() |
void |
prepareSession(long eventId,
long userId,
long groupId)
Stores the current event context information in a temporary table
so that triggers can make use of them.
|
void |
refreshEventLogFromUpdatedAnnotations()
Convert the _reindexing_required table to REINDEX entries in the event log.
|
void |
releaseSavepoint(java.lang.String savepoint) |
int |
removePassword(java.lang.Long id) |
java.util.Map<java.lang.String,java.lang.Object> |
repoFile(long value) |
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.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
roiByImage(long imageId) |
void |
rollbackSavepoint(java.lang.String savepoint) |
java.lang.String |
scriptRepo(long fileId,
java.util.Set<java.lang.String> mimetypes)
Similar to
fileRepo(long) , but only returns values for files
which are also scripts. |
long |
selectCurrentEventLog(java.lang.String key) |
java.lang.Long |
sessionId(java.lang.String uuid) |
void |
setCurrentEventLog(long id,
java.lang.String key) |
void |
setFileRepo(java.util.Collection<java.lang.Long> ids,
java.lang.String repoId) |
boolean |
setPermissionsBit(java.lang.String table,
long id,
int bit)
Sets the given permissions bit to
1 . |
void |
setPixelsNamePathRepo(long pixId,
java.lang.String name,
java.lang.String path,
java.lang.String repoId) |
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 |
synchronizeJobs(java.util.List<java.lang.Long> ids) |
int |
updateConfiguration(java.lang.String key,
java.lang.String value) |
int |
updateOrInsertConfigValue(java.lang.String name,
java.lang.String value) |
void prepareSession(long eventId, long userId, long groupId)
eventId
- userId
- groupId
- java.lang.String rewriteHql(java.lang.String query, java.lang.String key, java.lang.Object value)
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.java.lang.String createIdsTempTable(java.util.Collection<java.lang.Long> ids)
void createInsertTrigger(java.lang.String name, java.lang.String table, java.lang.String procedure)
boolean activeSession(java.lang.String sessionUUID)
sessionUUID
- NOT NULL.true
if sessionUUID
is an active session,
false
otherwiselong getGroupPermissions(long id)
ExperimenterGroup groupInfoFor(java.lang.String table, long id)
ExperimenterGroup
object containing
only the id, name, and permissions.java.lang.String fileRepo(long fileId)
java.lang.String scriptRepo(long fileId, java.util.Set<java.lang.String> mimetypes)
fileRepo(long)
, but only returns values for files
which are also scripts. Null may be returnedfileId
- mimetypes
- null implies all files are checkedint synchronizeJobs(java.util.List<java.lang.Long> ids)
java.lang.Long findRepoFile(java.lang.String uuid, java.lang.String dirname, java.lang.String basename)
findRepoFile(String, String, String, Set)
passing null.java.lang.Long findRepoFile(java.lang.String uuid, java.lang.String dirname, java.lang.String basename, java.lang.String mimetype)
java.lang.Long findRepoFile(java.lang.String uuid, java.lang.String dirname, java.lang.String basename, java.util.Set<java.lang.String> mimetypes)
OriginalFile
in a given
repository or return null if none is found.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.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)
findRepoFile(String, String, String, Set)
, but queries in
bulk and returns a map for the found IDs.java.util.List<java.lang.Long> findRepoFiles(java.lang.String repoUuid, java.lang.String dirname)
repoUuid
- dirname
- java.util.List<SqlAction.DeleteLog> findRepoDeleteLogs(SqlAction.DeleteLog template)
SqlAction.DeleteLog
entries which match all of the non-null
fields provided in the template.template
- non-null.SqlAction.DeleteLog
entriesint deleteRepoDeleteLogs(SqlAction.DeleteLog template)
SqlAction.DeleteLog
entries which match all of the non-null
fields provided in the template.template
- not-nulljava.lang.String findRepoRootPath(java.lang.String uuid)
uuid
- a repository UUIDjava.lang.String findRepoFilePath(java.lang.String uuid, long id)
java.util.List<java.lang.Long> findRepoPixels(java.lang.String uuid, java.lang.String dirname, java.lang.String basename)
java.lang.Long findRepoImageFromPixels(long id)
int repoScriptCount(java.lang.String uuid, java.util.Set<java.lang.String> mimetypes)
uuid
- repository identifiermimetypes
- file mimetypes to check; if null, all files;java.lang.Long nextSessionId()
java.util.List<java.lang.Long> fileIdsInDb(java.lang.String uuid, java.util.Set<java.lang.String> mimetypes)
java.util.List<java.lang.Long> filterFileIdsByRepo(java.lang.String uuid, java.util.List<java.lang.Long> fileIds)
uuid
- a repository UUIDfileIds
- IDs of original filesjava.util.Map<java.lang.String,java.lang.Object> repoFile(long value)
java.util.List<long[]> nextPixelsDataLogForRepo(java.lang.String repo, long lastEventId, int howmany)
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.long countFormat(java.lang.String name)
@Deprecated int insertFormat(java.lang.String name)
int closeSessions(java.lang.String uuid)
int closeNodeSessions(java.lang.String uuid)
int closeNode(java.lang.String uuid)
long nodeId(java.lang.String internal_uuid)
int insertSession(java.util.Map<java.lang.String,java.lang.Object> params)
java.lang.Long sessionId(java.lang.String uuid)
int isFileInRepo(java.lang.String uuid, long id, java.util.Set<java.lang.String> mimetypes)
uuid
- Repository identifierid
- file identifiermimetypes
- Set of mimetypes to check; if null, all files.int removePassword(java.lang.Long id)
java.util.Date now()
int updateConfiguration(java.lang.String key, java.lang.String value)
java.lang.String dbVersion()
java.lang.String configValue(java.lang.String name)
int delConfigValue(java.lang.String name)
int updateOrInsertConfigValue(java.lang.String name, java.lang.String value)
java.lang.String dbUuid()
long selectCurrentEventLog(java.lang.String key)
float getEventLogPercent(java.lang.String key)
key
- PersistentEventLogLoader key for lookup in the configuration tablejava.util.List<java.lang.Object[]> getEventLogPartitions(java.util.Collection<java.lang.String> types, java.util.Collection<java.lang.String> actions, long offset, long limit)
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.void setCurrentEventLog(long id, java.lang.String key)
void delCurrentEventLog(java.lang.String key)
void refreshEventLogFromUpdatedAnnotations()
long nextValue(java.lang.String segmentName, int incrementSize)
segmentName
- incrementSize
- long currValue(java.lang.String segmentName)
void insertLogs(java.util.List<java.lang.Object[]> batchData)
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> roiByImage(long imageId)
java.util.List<java.lang.Long> getShapeIds(long roiId)
boolean setUserPassword(java.lang.Long experimenterID, java.lang.String password)
java.lang.String getPasswordHash(java.lang.Long experimenterID)
java.lang.Long getUserId(java.lang.String userName)
userName
- the user's namenull
if they cannot be foundjava.lang.String getUsername(long userId)
userId
- the user's IDnull
if they cannot be foundjava.util.Collection<java.lang.String> getUserEmailsByGroup(long groupId)
groupId
- Collection
of non-empty user email addresses.java.util.List<java.lang.Long> getLdapExperimenters()
ldap
attribute enabled.boolean isLdapExperimenter(java.lang.Long id)
ldap
flag set.id
- The experimenter ID.java.util.Map<java.lang.String,java.lang.Long> getGroupIds(java.util.Collection<java.lang.String> names)
java.util.List<java.lang.String> getUserGroups(java.lang.String userName)
void setFileRepo(java.util.Collection<java.lang.Long> ids, java.lang.String repoId)
void setPixelsNamePathRepo(long pixId, java.lang.String name, java.lang.String path, java.lang.String repoId)
java.util.List<java.lang.Long> getDeletedIds(java.lang.String entityType)
void createSavepoint(java.lang.String savepoint)
void releaseSavepoint(java.lang.String savepoint)
void rollbackSavepoint(java.lang.String savepoint)
void deferConstraints()
java.util.Map<java.lang.Long,byte[]> getShareData(java.util.List<java.lang.Long> ids)
ids
- IDs of Shares for which data blobs are to be returned.java.util.List<java.lang.String> getPixelsNamePathRepo(long id) throws InternalException
InternalException
java.util.Set<java.lang.String> currentUserNames()
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 hasUnicodeUnits()
void addMessageWithinDbPatchStart(java.lang.String version, int patch, java.lang.String message)
version
- the version of the current DBpatch
- the patch of the current DBmessage
- the new message to notevoid addMessageWithinDbPatchEnd(java.lang.String version, int patch, java.lang.String message)
version
- the version of the current DBpatch
- the patch of the current DBmessage
- the new message to noteboolean setPermissionsBit(java.lang.String table, long id, int bit)
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.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 bitboolean clearPermissionsBit(java.lang.String table, long id, int bit)
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.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 bitvoid setRoles(long rootUserId, long guestUserId, long systemGroupId, long userGroupId, long guestGroupId)
rootUserId
- the root user's IDguestUserId
- the guest user's IDsystemGroupId
- the system group's IDuserGroupId
- the user group's IDguestGroupId
- the guest group's IDjava.util.Collection<java.lang.Long> findOldAdminPrivileges()
void deleteOldAdminPrivileges(java.util.Collection<java.lang.Long> transactionIds)
transactionIds
- the transaction IDs to deletevoid deleteCurrentAdminPrivileges()
void insertCurrentAdminPrivileges(java.lang.Iterable<AdminPrivilege> privileges)
privileges
- some light administrator privileges