public abstract static class SqlAction.Impl extends 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 SimpleJdbcOperations |
_jdbc() |
protected abstract String |
_lookup(String key) |
void |
addMessageWithinDbPatchEnd(String version,
int patch,
String message)
Add a unique message to the DB patch table within the current patch.
|
void |
addMessageWithinDbPatchStart(String version,
int patch,
String message)
Add a unique message to the DB patch table within the current patch.
|
protected String |
addMimetypes(Collection<String> mimetypes,
Map<String,Object> params)
Returns the "and_mimetype" clause which must be appended to a given
query.
|
int |
changeGroupPermissions(Long id,
Long internal) |
int |
changeTablePermissionsForGroup(String table,
Long id,
Long internal) |
boolean |
clearPermissionsBit(String table,
long id,
int bit)
Sets the given permissions bit to
0 . |
int |
closeNode(String uuid) |
int |
closeNodeSessions(String uuid) |
String |
configValue(String key) |
String |
createIdsTempTable(Collection<Long> ids)
Creates a temporary table filled with the given ids and returns its
name.
|
void |
createInsertTrigger(String name,
String table,
String procedure)
Creates an insert trigger of the given name, for the given table,
with the given procedure.
|
int |
delConfigValue(String key) |
void |
delCurrentEventLog(String key) |
int |
deleteRepoDeleteLogs(SqlAction.DeleteLog template)
Delete all
SqlAction.DeleteLog entries which match all of the non-null
fields provided in the template. |
List<Long> |
fileIdsInDb(String uuid,
Set<String> mimetypes)
Return all IDs matching the given mimetypes, or all IDs if mimetypes is null.
|
String |
fileRepo(long fileId) |
List<Long> |
filterFileIdsByRepo(String uuid,
List<Long> fileIds)
Find the original file IDs among those given that are in the given repository.
|
List<SqlAction.DeleteLog> |
findRepoDeleteLogs(SqlAction.DeleteLog template)
Find all
SqlAction.DeleteLog entries which match all of the non-null
fields provided in the template. |
Long |
findRepoFile(String uuid,
String dirname,
String basename)
Calls
SqlAction.findRepoFile(String, String, String, Set)
passing null. |
Long |
findRepoFile(String uuid,
String dirname,
String basename,
Set<String> mimetypes)
Lookup the id of an
OriginalFile in a given
repository or return null if none is found. |
Long |
findRepoFile(String uuid,
String dirname,
String basename,
String mimetype)
|
String |
findRepoFilePath(String uuid,
long id) |
List<Long> |
findRepoFiles(String uuid,
String dirname)
Return a list of original file ids that all have a path value matching
the passed dirname in the given repository.
|
Map<String,Long> |
findRepoFiles(String uuid,
String dirname,
List<String> basenames,
Set<String> mimetypes)
Like
SqlAction.findRepoFile(String, String, String, Set) , but queries in
bulk and returns a map for the found IDs. |
String |
findRepoRootPath(String uuid)
Find the path of the repository root.
|
List<Object[]> |
getEventLogPartitions(Collection<String> types,
Collection<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(String key)
Returns the percent (e.g. 0-100%) as calculated by the number of rows
represented as completed by the configuration table row of this key
divided by the total number of rows in the event log.
|
Map<String,Long> |
getGroupIds(Collection<String> names) |
long |
getGroupPermissions(long groupId)
Returns the permissions for the given group id.
|
List<Long> |
getLdapExperimenters()
Gets the experimenters who have the
ldap attribute enabled. |
String |
getPasswordHash(Long experimenterID) |
Map<Long,byte[]> |
getShareData(List<Long> ids)
Returns a map of Share ID to Share data blob.
|
Collection<String> |
getUserEmailsByGroup(long groupId)
Load all the non-empty email addresses for users in a given group.
|
List<String> |
getUserGroups(String userName) |
Long |
getUserId(String userName)
Get the user's ID
|
String |
getUsername(long userId)
Get the user's name
|
ExperimenterGroup |
groupInfoFor(String table,
long id)
Return a mostly unloaded
ExperimenterGroup object containing
only the id, name, and permissions. |
boolean |
hasUnicodeUnits() |
int |
isFileInRepo(String uuid,
long id,
Set<String> mimetypes) |
boolean |
isLdapExperimenter(Long id)
Checks whether the specified experimenter ID has the
ldap
flag set. |
List<long[]> |
nextPixelsDataLogForRepo(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 String |
printThrowable(Throwable t) |
void |
refreshEventLogFromUpdatedAnnotations()
Convert the _updated_annotations table to REINDEX entries in the event log.
|
int |
repoScriptCount(String uuid,
Set<String> mimetypes) |
String |
rewriteHql(String query,
String key,
Object value)
Allows the specific database implementations a chance to modify
queries.
|
String |
scriptRepo(long fileId,
Set<String> mimetypes)
Similar to
SqlAction.fileRepo(long) , but only returns values for files
which are also scripts. |
long |
selectCurrentEventLog(String key) |
void |
setCurrentEventLog(long id,
String key) |
boolean |
setPermissionsBit(String table,
long id,
int bit)
Sets the given permissions bit to
1 . |
long |
setStatsInfo(Channel ch,
StatsInfo si) |
boolean |
setUserPassword(Long experimenterID,
String password) |
int |
updateOrInsertConfigValue(String name,
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, roiByImageAndNs, rollbackSavepoint, sessionId, setFileRepo, setPixelsNamePathRepo, synchronizeJobs, updateConfiguration
protected static final int MAX_IN_SIZE
protected final org.slf4j.Logger log
protected abstract SimpleJdbcOperations _jdbc()
public void createInsertTrigger(String name, String table, String procedure)
SqlAction
createInsertTrigger
in interface SqlAction
public String rewriteHql(String query, String key, 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 String createIdsTempTable(Collection<Long> ids)
SqlAction
createIdsTempTable
in interface SqlAction
public int closeNodeSessions(String uuid)
closeNodeSessions
in interface SqlAction
public boolean setUserPassword(Long experimenterID, String password)
setUserPassword
in interface SqlAction
public int changeGroupPermissions(Long id, Long internal)
changeGroupPermissions
in interface SqlAction
public int changeTablePermissionsForGroup(String table, Long id, Long internal)
changeTablePermissionsForGroup
in interface SqlAction
public boolean setPermissionsBit(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(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 bitprotected String addMimetypes(Collection<String> mimetypes, Map<String,Object> params)
mimetypes
- If null, then "" will be returned.params
- sql parameter source to be passed to JDBC methods.public Long findRepoFile(String uuid, String dirname, String basename)
SqlAction
SqlAction.findRepoFile(String, String, String, Set)
passing null.findRepoFile
in interface SqlAction
public Long findRepoFile(String uuid, String dirname, String basename, String mimetype)
SqlAction
findRepoFile
in interface SqlAction
public Long findRepoFile(String uuid, String dirname, String basename, Set<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 Map<String,Long> findRepoFiles(String uuid, String dirname, List<String> basenames, Set<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(String uuid, Set<String> mimetypes)
repoScriptCount
in interface SqlAction
uuid
- repository identifiermimetypes
- file mimetypes to check; if null, all files;public int isFileInRepo(String uuid, long id, Set<String> mimetypes)
isFileInRepo
in interface SqlAction
uuid
- Repository identifierid
- file identifiermimetypes
- Set of mimetypes to check; if null, all files.public List<Long> fileIdsInDb(String uuid, Set<String> mimetypes)
SqlAction
fileIdsInDb
in interface SqlAction
public List<Long> filterFileIdsByRepo(String uuid, List<Long> fileIds)
SqlAction
filterFileIdsByRepo
in interface SqlAction
uuid
- a repository UUIDfileIds
- IDs of original filespublic List<Long> findRepoFiles(String uuid, String dirname)
SqlAction
findRepoFiles
in interface SqlAction
public 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 String findRepoRootPath(String uuid)
SqlAction
findRepoRootPath
in interface SqlAction
uuid
- a repository UUIDpublic String findRepoFilePath(String uuid, long id)
findRepoFilePath
in interface SqlAction
public List<long[]> nextPixelsDataLogForRepo(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 Map<String,Long> getGroupIds(Collection<String> names)
getGroupIds
in interface SqlAction
public String getPasswordHash(Long experimenterID)
getPasswordHash
in interface SqlAction
public Long getUserId(String userName)
SqlAction
public Collection<String> getUserEmailsByGroup(long groupId)
SqlAction
getUserEmailsByGroup
in interface SqlAction
Collection
of non-empty user email addresses.public String getUsername(long userId)
SqlAction
getUsername
in interface SqlAction
userId
- the user's IDnull
if they cannot be foundpublic List<Long> getLdapExperimenters()
SqlAction
ldap
attribute enabled.getLdapExperimenters
in interface SqlAction
public boolean isLdapExperimenter(Long id)
SqlAction
ldap
flag set.isLdapExperimenter
in interface SqlAction
id
- The experimenter ID.public List<String> getUserGroups(String userName)
getUserGroups
in interface SqlAction
public ExperimenterGroup groupInfoFor(String table, long id)
SqlAction
ExperimenterGroup
object containing
only the id, name, and permissions.groupInfoFor
in interface SqlAction
public String scriptRepo(long fileId, Set<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 String configValue(String key)
configValue
in interface SqlAction
public int delConfigValue(String key)
delConfigValue
in interface SqlAction
public int updateOrInsertConfigValue(String name, String value)
updateOrInsertConfigValue
in interface SqlAction
public long selectCurrentEventLog(String key)
selectCurrentEventLog
in interface SqlAction
public float getEventLogPercent(String key)
SqlAction
getEventLogPercent
in interface SqlAction
key
- PersistentEventLogLoader key for lookup in the configuration tablepublic List<Object[]> getEventLogPartitions(Collection<String> types, Collection<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, String key)
setCurrentEventLog
in interface SqlAction
public void delCurrentEventLog(String key)
delCurrentEventLog
in interface SqlAction
public void refreshEventLogFromUpdatedAnnotations()
SqlAction
refreshEventLogFromUpdatedAnnotations
in interface SqlAction
public boolean hasUnicodeUnits()
hasUnicodeUnits
in interface SqlAction
public void addMessageWithinDbPatchStart(String version, int patch, 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(String version, int patch, 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 Map<Long,byte[]> getShareData(List<Long> ids)
SqlAction
getShareData
in interface SqlAction
ids
- IDs of Shares for which data blobs are to be returned.
Version: 5.2.8-ice35-b57
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.