Package ome.services.blitz.repo
Interface RepositoryDao
-
- All Known Implementing Classes:
RepositoryDaoImpl
public interface RepositoryDao
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canUpdate(IObject obj, Ice.Current current)
Delegates to IAdmin#canUpdatevoid
createOrFixUserDir(java.lang.String uuid, java.util.List<CheckedPath> path, org.hibernate.Session s, ome.system.ServiceFactory sf, ome.util.SqlAction sql)
Checks that the givenCheckedPath
objects exist (viafindRepoFile(String, CheckedPath, String, Ice.Current)
) and are in the "user" group.java.util.List<java.lang.Integer>
deleteRepoDeleteLogs(java.util.List<ome.util.SqlAction.DeleteLog> templates, Ice.Current current)
CallSqlAction.deleteRepoDeleteLogs(DeleteLog)
with the current context for a number of templates.int
deleteRepoDeleteLogs(ome.util.SqlAction.DeleteLog template, Ice.Current current)
CallSqlAction.deleteRepoDeleteLogs(DeleteLog)
with the current context.java.util.List<java.lang.Long>
filterFilesByRepository(java.lang.String repo, java.util.List<java.lang.Long> ids, Ice.Current current)
Find the original file IDs among those given that are in the given repository.java.util.List<java.util.List<ome.util.SqlAction.DeleteLog>>
findRepoDeleteLogs(java.util.List<ome.util.SqlAction.DeleteLog> templates, Ice.Current current)
AsfindRepoDeleteLogs(DeleteLog, Current)
but for a collection of templates.java.util.List<ome.util.SqlAction.DeleteLog>
findRepoDeleteLogs(ome.util.SqlAction.DeleteLog template, Ice.Current current)
CallSqlAction.findRepoDeleteLogs(DeleteLog)
with the current context.OriginalFile
findRepoFile(java.lang.String uuid, CheckedPath checked, java.lang.String mimetype, Ice.Current current)
Delegate toSqlAction.findRepoFile(String, String, String, String)
for looking up the id of the file, and then load it normally via IQuery.ome.model.core.OriginalFile
findRepoFile(ome.system.ServiceFactory sf, ome.util.SqlAction sql, java.lang.String uuid, CheckedPath checked, java.lang.String mimetype)
AsfindRepoFile(String, CheckedPath, String, Current)
but can be called from within a transaction.ome.model.enums.ChecksumAlgorithm
getChecksumAlgorithm(java.lang.String name, Ice.Current current)
Retrieve the checksum algorithm of the given name.EventContext
getEventContext(Ice.Current current)
Look up information for the current session as specified in the ctx field of the current.FsFile
getFile(long id, Ice.Current current, java.lang.String repoUuid)
Get anFsFile
object based on its ID.OriginalFile
getOriginalFile(long fileId, Ice.Current current)
Gets the original file instance for a given file ID.java.util.List<OriginalFile>
getOriginalFiles(java.lang.String repoUuid, CheckedPath checked, Ice.Current current)
Return a non-null, possibly empty list ofOriginalFile
elements which are accessible to the given user at the given path.ome.model.core.OriginalFile
getOriginalFileWithHasher(long id, Ice.Current current)
Retrieve the original file of the given ID.ome.api.RawFileStore
getRawFileStore(long fileId, CheckedPath checked, java.lang.String mode, Ice.Current current)
Create aRawFileBean
(i.e.java.lang.String
getUserInstitution(long userId, Ice.Current current)
Get the current user's institution.java.lang.String
getUserInstitution(long userId, ome.system.ServiceFactory sf)
Get the current user's institution.java.util.List<Fileset>
loadFilesets(java.util.List<java.lang.Long> ids, Ice.Current current)
Load filesets by id.void
makeDirs(PublicRepositoryI repo, java.util.List<CheckedPath> dirs, boolean parents, Ice.Current c)
Create a number of directories in a single transaction, using thePublicRepositoryI
instance as a callback for implementation specific logic.OriginalFile
register(java.lang.String repoUuid, CheckedPath checked, java.lang.String mimetype, Ice.Current current)
Register an OriginalFile objectome.model.core.OriginalFile
register(java.lang.String repoUuid, CheckedPath checked, java.lang.String mimetype, ome.system.ServiceFactory sf, ome.util.SqlAction sql, org.hibernate.Session session)
Likeregister(String, CheckedPath, String, Ice.Current)
but does not create a new transaction.Fileset
saveFileset(java.lang.String repoUuid, Fileset fs, ChecksumAlgorithm checksumAlgorithm, java.util.List<CheckedPath> paths, Ice.Current current)
Fill the various fields of theFileset
and then save the entire instance into the database.<T extends Job>
TsaveJob(T job, Ice.Current current)
Create a job from an instance provided by either the client or the server.void
saveObject(ome.model.IObject object, Ice.Current current)
Save the given model object.RMap
treeList(java.lang.String repoUuid, CheckedPath checked, Ice.Current __current)
void
updateJob(Job job, java.lang.String message, java.lang.String status, Ice.Current current)
Set both the message and the status of the given job.
-
-
-
Method Detail
-
getRawFileStore
ome.api.RawFileStore getRawFileStore(long fileId, CheckedPath checked, java.lang.String mode, Ice.Current current) throws SecurityViolation
Create aRawFileBean
(i.e. an implementation ofRawFileStore
which can be passed toRepoRawFileStoreI
for performing internal functions. The primary difference to an instance created via the ServiceFactory is that theRawFileBean.setFileIdWithBuffer(long, FileBuffer)
method is called pointing to a non-romio file path, e.g. /OMERO/Files/x.- Parameters:
fileId
- ID of anOriginalFile
checked
- Not null. Normalized path from the repository.mode
- FileChannel mode, "r", "rw", etc.- Returns:
- An instance with
RawFileBean.setFileIdWithBuffer(long, FileBuffer)
called. - Throws:
SecurityViolation
-
findRepoFile
OriginalFile findRepoFile(java.lang.String uuid, CheckedPath checked, java.lang.String mimetype, Ice.Current current) throws ServerError
Delegate toSqlAction.findRepoFile(String, String, String, String)
for looking up the id of the file, and then load it normally via IQuery. This will enforce any read security checks.- Parameters:
uuid
-checked
-mimetype
-current
-- Returns:
- See above.
- Throws:
ServerError
-
findRepoFile
ome.model.core.OriginalFile findRepoFile(ome.system.ServiceFactory sf, ome.util.SqlAction sql, java.lang.String uuid, CheckedPath checked, java.lang.String mimetype)
AsfindRepoFile(String, CheckedPath, String, Current)
but can be called from within a transaction.
-
treeList
RMap treeList(java.lang.String repoUuid, CheckedPath checked, Ice.Current __current) throws ServerError
- Throws:
ServerError
-
createOrFixUserDir
void createOrFixUserDir(java.lang.String uuid, java.util.List<CheckedPath> path, org.hibernate.Session s, ome.system.ServiceFactory sf, ome.util.SqlAction sql) throws ServerError
Checks that the givenCheckedPath
objects exist (viafindRepoFile(String, CheckedPath, String, Ice.Current)
) and are in the "user" group. If they don't exist, they are created; and if they aren't in the "user" group, they are moved.- Throws:
ServerError
-
canUpdate
boolean canUpdate(IObject obj, Ice.Current current)
Delegates to IAdmin#canUpdate- Parameters:
obj
-current
-- Returns:
- See above.
- Throws:
an
-SecurityViolation
if the currentUser is not allowed to access the given file.
-
filterFilesByRepository
java.util.List<java.lang.Long> filterFilesByRepository(java.lang.String repo, java.util.List<java.lang.Long> ids, Ice.Current current)
Find the original file IDs among those given that are in the given repository.- Parameters:
repo
- a repository UUIDids
- IDs of original filescurrent
- Ice method invocation context- Returns:
- those IDs among those given whose original files are in the given repository
-
getOriginalFile
OriginalFile getOriginalFile(long fileId, Ice.Current current) throws SecurityViolation
Gets the original file instance for a given file ID.- Parameters:
fileId
- a file IDcurrent
- applicable ICE context- Returns:
- the original file corresponding to the given file ID
- Throws:
SecurityViolation
- if the query threw a security violation
-
getOriginalFiles
java.util.List<OriginalFile> getOriginalFiles(java.lang.String repoUuid, CheckedPath checked, Ice.Current current) throws SecurityViolation
Return a non-null, possibly empty list ofOriginalFile
elements which are accessible to the given user at the given path. If the directory which they are associated with is not also readable by the current user, then aSecurityViolation
will be thrown.- Parameters:
repoUuid
- for the repository in question.checked
- normalized path which can be found as the value ofOriginalFile.getPath()
in the database.current
-- Throws:
SecurityViolation
-
saveFileset
Fileset saveFileset(java.lang.String repoUuid, Fileset fs, ChecksumAlgorithm checksumAlgorithm, java.util.List<CheckedPath> paths, Ice.Current current) throws ServerError
Fill the various fields of theFileset
and then save the entire instance into the database.- Parameters:
repoUuid
- for the repository in question.fs
- a user providedFileset
that must minimally have theFilesetEntry
objects present with their clientPath set. The rest of the fields will be filled here.checksumAlgorithm
- The algorithm to use.paths
- a List of the same size as the number of entries in fs one perFilesetEntry
.current
- Current context- Throws:
ServerError
-
loadFilesets
java.util.List<Fileset> loadFilesets(java.util.List<java.lang.Long> ids, Ice.Current current) throws ServerError
Load filesets by id.- Parameters:
ids
-current
-- Returns:
- See above.
- Throws:
ServerError
-
register
OriginalFile register(java.lang.String repoUuid, CheckedPath checked, java.lang.String mimetype, Ice.Current current) throws ServerError
Register an OriginalFile object- Parameters:
repoUuid
- uuid of the repository that the given file argument should be registered with. Cannot be null.checked
- Normalized path provided by the repository. Not null.mimetype
- Mimetype for use with the OriginalFile. May be null in which case a default will be chosen.current
- Not null.- Returns:
- The OriginalFile with id set (unloaded)
- Throws:
ServerError
-
register
ome.model.core.OriginalFile register(java.lang.String repoUuid, CheckedPath checked, java.lang.String mimetype, ome.system.ServiceFactory sf, ome.util.SqlAction sql, org.hibernate.Session session) throws ServerError
Likeregister(String, CheckedPath, String, Ice.Current)
but does not create a new transaction. Instead, theServiceFactory
andSqlAction
must be passed in. The returned OriginalFile instance is still connected to Hibernate.- Parameters:
repoUuid
-checked
-mimetype
-sf
-sql
-session
-- Returns:
- See above.
- Throws:
ServerError
-
getFile
FsFile getFile(long id, Ice.Current current, java.lang.String repoUuid)
Get anFsFile
object based on its ID. Returns null if the file does not exist or does not belong to this repository.- Parameters:
id
- database ID of the sought original filecurrent
- current applicable ICE contextrepoUuid
- the UUID of the repository containing the original file- Returns:
- the requested FsFile object
-
saveJob
<T extends Job> T saveJob(T job, Ice.Current current) throws ServerError
Create a job from an instance provided by either the client or the server. Only those fields which are modifiable by the user will be copied.- Parameters:
job
- Not null.current
- Not null.- Returns:
- See above.
- Throws:
ServerError
-
updateJob
void updateJob(Job job, java.lang.String message, java.lang.String status, Ice.Current current) throws ServerError
Set both the message and the status of the given job.- Parameters:
job
- Not null.message
- If null, no modification will be made for the messagestatus
- If null, no modification will be made for the status.current
- Not null.- Throws:
ServerError
-
getEventContext
EventContext getEventContext(Ice.Current current)
Look up information for the current session as specified in the ctx field of the current.
-
getUserInstitution
java.lang.String getUserInstitution(long userId, Ice.Current current)
Get the current user's institution.- Parameters:
userId
- the ID of the user whose institution is to be fetchedcurrent
- the current ICE method invocation context- Returns:
- the institution, may be
null
-
getUserInstitution
java.lang.String getUserInstitution(long userId, ome.system.ServiceFactory sf)
Get the current user's institution.- Parameters:
userId
- the ID of the user whose institution is to be fetchedsf
- the service factory to use for the query- Returns:
- the institution, may be
null
-
findRepoDeleteLogs
java.util.List<ome.util.SqlAction.DeleteLog> findRepoDeleteLogs(ome.util.SqlAction.DeleteLog template, Ice.Current current)
CallSqlAction.findRepoDeleteLogs(DeleteLog)
with the current context.- Parameters:
template
- not null.current
- not null.- Returns:
- all the rows found which match the non-null fields on templates
-
findRepoDeleteLogs
java.util.List<java.util.List<ome.util.SqlAction.DeleteLog>> findRepoDeleteLogs(java.util.List<ome.util.SqlAction.DeleteLog> templates, Ice.Current current)
AsfindRepoDeleteLogs(DeleteLog, Current)
but for a collection of templates.- Parameters:
templates
- not null.current
- not null.- Returns:
- all the rows found which match the non-null fields on templates
-
deleteRepoDeleteLogs
int deleteRepoDeleteLogs(ome.util.SqlAction.DeleteLog template, Ice.Current current)
CallSqlAction.deleteRepoDeleteLogs(DeleteLog)
with the current context.- Parameters:
template
- not null.current
- not null.- Returns:
- the number of rows deleted
-
deleteRepoDeleteLogs
java.util.List<java.lang.Integer> deleteRepoDeleteLogs(java.util.List<ome.util.SqlAction.DeleteLog> templates, Ice.Current current)
CallSqlAction.deleteRepoDeleteLogs(DeleteLog)
with the current context for a number of templates.- Parameters:
templates
- not null.current
- not null.- Returns:
- A list containing the number of rows deleted
-
makeDirs
void makeDirs(PublicRepositoryI repo, java.util.List<CheckedPath> dirs, boolean parents, Ice.Current c) throws ServerError
Create a number of directories in a single transaction, using thePublicRepositoryI
instance as a callback for implementation specific logic. Applies thereal user
's event context when within aPublicRepositoryI.sudo(Current, String)
.- Throws:
ServerError
-
getChecksumAlgorithm
ome.model.enums.ChecksumAlgorithm getChecksumAlgorithm(java.lang.String name, Ice.Current current)
Retrieve the checksum algorithm of the given name.- Parameters:
name
- a checksum algorithm name, must existcurrent
- Ice method invocation context- Returns:
- the corresponding checksum algorithm model object
-
getOriginalFileWithHasher
ome.model.core.OriginalFile getOriginalFileWithHasher(long id, Ice.Current current)
Retrieve the original file of the given ID.- Parameters:
id
- the ID of an original file, must existcurrent
- Ice method invocation context- Returns:
- the corresponding original file model object
-
saveObject
void saveObject(ome.model.IObject object, Ice.Current current)
Save the given model object.- Parameters:
object
- a model objectcurrent
- Ice method invocation context
-
-