public interface IContainer extends ServiceInterface
The names of the methods correlate to how the function operates:
The options are used to add some constraints to the generic method e.g. load hierarchy trees images for a given user. This mechanism should give us enough flexibility to extend the API if necessary, e.g. in some cases we might want to retrieve the images with or without annotations
Most methods take such an options
map which is built on the
client-side using an option builder.
The
currently supported options are:
As outlined in TODO, the semantics of the Omero write API are based on three rules:
isLoaded()
returns false
are assumed filteredgetDetails().isFiltered(String collectionName)
returns true
are assumed filtered. TODO: should we accept isFiltered for all fields?
For all write calls, the options map (see below) must contain the userId and the userGroupId for the newly created objects. TODO umask.
Modifier and Type | Method and Description |
---|---|
<T extends IObject> |
createDataObject(T object,
Parameters options)
Creates the specified data object.
|
IObject[] |
createDataObjects(IObject[] dataObjects,
Parameters options)
convenience method to save network calls.
|
<T extends IObject> |
findContainerHierarchies(Class<T> rootNodeType,
Set<Long> imagesIds,
Parameters options)
Retrieves hierarchy trees in various hierarchies that contain the
specified Images.
|
Map |
getCollectionCount(String type,
String property,
Set<Long> ids,
Parameters options)
Counts the number of members in a collection for a given object.
|
<T extends IObject> |
getImages(Class<T> rootNodeType,
Set<Long> rootNodeIds,
Parameters options)
Retrieve a user's (or all users') images within any given container.
|
Set<Image> |
getImagesByOptions(Parameters options)
Retrieve images by options.
|
Map<Long,Map<Boolean,List<Long>>> |
getImagesBySplitFilesets(Map<Class<? extends IObject>,List<Long>> included,
Parameters options)
Given a list of IDs of certain entity types, calculates which filesets are split such that
a non-empty proper subset of their images are referenced, directly or indirectly, as being
included.
|
Set<Image> |
getUserImages(Parameters options)
Retrieve a user's images.
|
ILink[] |
link(ILink[] dataObjectLinks,
Parameters options)
Convenience method for creating links.
|
<T extends IObject> |
loadContainerHierarchy(Class<T> rootNodeType,
Set<Long> rootNodeIds,
Parameters options)
Retrieves hierarchy trees rooted by a given node (unless orphan is
specified -- See below)
This method also retrieves the Experimenters linked to the objects in the
tree.
|
Collection |
retrieveCollection(IObject dataObject,
String collectionName,
Parameters options)
Retrieves a collection with all members initialized ("loaded").
|
void |
unlink(ILink[] dataOjectLinks,
Parameters options)
Removes links between OmeroDataObjects e.g Project-Dataset, Dataset-Image
Note that the objects themselves aren't deleted, only the Link objects.
|
<T extends IObject> |
updateDataObject(T dataObject,
Parameters options)
Updates a data object.
|
IObject[] |
updateDataObjects(IObject[] dataObjects,
Parameters options)
convenience method to save network calls.
|
<T extends IObject> Set<IObject> loadContainerHierarchy(Class<T> rootNodeType, Set<Long> rootNodeIds, Parameters options)
This method also retrieves the Experimenters linked to the objects in the tree. Similarly, all Images will be linked to their Pixel objects if included.
Note that objects are never duplicated. For example, if an Experimenter
owns all the objects in the retrieved tree, then those objects will be
linked to the same instance of Experimenter
. Or if an
Image is contained in more than one Dataset in the retrieved tree, then
all enclosing Dataset
objects will point to the same
Image
object. And so on.
rootNodeType
- The type of the root node. Can be Project
,
Dataset
, Screen
or Plate
.
Cannot be null.rootNodeIds
- The ids of the root nodes. Can be null if an Experimenter is
specified in options
, otherwise an Exception
is thrown to prevent all images in the entire database from
being downloaded.options
- Parameters as above. annotator
, leaves
,
orphan
, acquisition data
used.
acquisition data
is only relevant for images
and taken into account if the images are loaded.
If rootNodeIds==null
,
experimenter|group
must be set and filtering
will be applied at the Class-level; e.g. to retrieve a
user's Projects, or user's Datasets. If
rootNodeIds!=null
, the result will be filtered
by the experimenter|group
at the
Image
and intermediate levels if available.
Due to the amount of data potentially linked a Screen/Plate,
the leaves
option is not taken into account.
when the root node is a Screen
.
orphan
implies that objects which are not contained
in an object of rootNodeType should also be returned.rootNodeType
, unless orphan
is specified
in which case objects of type rootNodeType
and below
may be returned.<T extends IObject> Set<IObject> findContainerHierarchies(Class<T> rootNodeType, Set<Long> imagesIds, Parameters options)
This method will look for all the containers containing the specified Images and then for all containers containing those containers and on up the container hierarchy.
This method returns a Set
with all root nodes that were
found. Every root node is linked to the found objects and so on until the
leaf nodes, which are Image
objects. Note that the type of any
root node in the returned set can be the given rootNodeType, any of its
containees or an image
.
For example, say that you pass in the ids of six Images: i1, i2,
i3, i4, i5, i6
.
If the P/D/I hierarchy in the DB looks like this:
__p1__ / \ _d1_ _d2_ d3 / \ / \ | i1 i2 i3 i4 i5 i6
Then the returned set will contain p1, d3, i5, i6
. All
objects will be properly linked up.
Finally, this method will only retrieve the nodes that are
connected in a tree to the specified leaf image nodes. Back to the
previous example, if d1
contained image
img500
, then the returned object would not
contain img500
. In a similar way, if p1
contained ds300
and this dataset weren't linked to any of
the i1, i2, i3, i4, i5, i6
images, then ds300
would not be part of the returned tree rooted by p1
.
rootNodeType
- top-most type which will be searched for Can be
Project
. Not null.imagesIds
- Contains the ids of the Images that sit at the bottom of the
trees. Not null.options
- Parameters as above. annotator
used.
experimenter|group
may be applied at the
top-level only or at each level in the hierarchy, but will not
apply to the leaf (Image) level.Set
with all root nodes that were found.<T extends IObject> Set<Image> getImages(Class<T> rootNodeType, Set<Long> rootNodeIds, Parameters options)
rootNodeType
- A Class which will have its hierarchy searched for Images. Not
null. TODO types?rootNodeIds
- A set of ids of type rootNodeType
Not null.options
- Parameters as above. No notion of leaves
.
experimenter|group
apply at the Image level.
OPTIONS: - startTime and/or endTime should be
Timestamp.valueOf("YYYY-MM-DD hh:mm:ss.ms");
limit
and offset
are applied at
the Image-level. That is, calling with Dataset.class,
limit == 10 and offset == 0 will
first perform one query to get an effective set of
rootNodeIds, then getImages will be called with an effective
rootNodeType of Image.class and the new ids.
acquisition data
is only relevant for images.ome.util.builders.PojoOptions#paginate(int, int)
,
ome.util.builders.PojoOptions#startTime(java.sql.Timestamp)
,
ome.util.builders.PojoOptions#endTime(java.sql.Timestamp)
Set<Image> getImagesByOptions(Parameters options)
options
- Parameters as above. No notion of leaves
.
experimenter|group
apply at the Image level and
must be present. OPTIONS: - startTime and/or endTime
should be Timestamp.valueOf("YYYY-MM-DD hh:mm:ss.ms").
acquisition data
is only relevant for images.Set<Image> getUserImages(Parameters options)
options
- Parameters as above. No notion of leaves
.
experimenter|group
apply at the Image level and
must be present.Map getCollectionCount(String type, String property, Set<Long> ids, Parameters options)
type
- The fully-qualified classname of the object to be testedproperty
- Name of the property on that class, omitting getters and
setters.ids
- Set of Longs, the ids of the objects to testoptions
- Parameters. Unused.Map<Long,Map<Boolean,List<Long>>> getImagesBySplitFilesets(Map<Class<? extends IObject>,List<Long>> included, Parameters options)
included
- the entities includedoptions
- parameters, presently ignoredCollection retrieveCollection(IObject dataObject, String collectionName, Parameters options)
dataObject
- Can be "unloaded".collectionName
- public final static String
from the
IObject.classoptions
- Parameters. Unused.<T extends IObject> T createDataObject(T object, Parameters options)
A placeholder parent object is created if the data object is to be put in a collection.
For example, if the object is a Dataset
, we first create
a Project
as parent then we set the Dataset parent as
follows:
//pseudo-code TODO
Project p = new Project(id,false);
dataset.addProject(p);
then for each parent relationship a DataObject ILink#link
is
created.
object
- IObject. Supported: Project, Dataset,
Annotation, Group, Experimenter. Not null.IObject[] createDataObjects(IObject[] dataObjects, Parameters options)
dataObjects
- Array of Omero IObjects
options
- Parameters as above.createDataObject
void unlink(ILink[] dataOjectLinks, Parameters options)
dataObjectLinks
- Not null.options
- Parameters as above.ILink[] link(ILink[] dataObjectLinks, Parameters options)
createDataObject(IObject, Parameters)
dataObjectLinks
- Array of links to be created.options
- Parameters as above.<T extends IObject> T updateDataObject(T dataObject, Parameters options)
To link or unlink objects to the specified object, we should call the
methods link or unlink. TODO Or do we use for example
dataset.setProjects(set of projects) to add. Tink has to be set as
follows dataset->project and project->dataset.
Alternatively, you can make sure that the collection is exactly
how it should be in the database. If you can't guarantee this, it's best
to send all your collections back as null
dataObject
- Pojos-based IObject. Supported: supported: Project, Dataset,
Annotation, Group, Experimenter.options
- Parameters as above.IObject[] updateDataObjects(IObject[] dataObjects, Parameters options)
dataObjects
- options
- Parameters as above.updateDataObject(IObject, Parameters)
Version: 5.1.3-ice35-b52
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.