@Transactional public class PojosImpl extends AbstractLevel2Service implements IContainer
iQuery, iUpdate, metadata, queryFactory, sec
Constructor and Description |
---|
PojosImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkProperty(java.lang.String type,
java.lang.String property) |
protected void |
checkType(java.lang.String type) |
IObject |
createDataObject(IObject arg0,
Parameters arg1)
Creates the specified data object.
|
IObject[] |
createDataObjects(IObject[] arg0,
Parameters arg1)
convenience method to save network calls.
|
java.util.Set |
findContainerHierarchies(java.lang.Class rootNodeType,
java.util.Set imageIds,
Parameters options)
Retrieves hierarchy trees in various hierarchies that contain the
specified Images.
|
java.util.Map |
getCollectionCount(java.lang.String type,
java.lang.String property,
java.util.Set ids,
Parameters options)
Counts the number of members in a collection for a given object.
|
java.util.Set |
getImages(java.lang.Class rootNodeType,
java.util.Set rootNodeIds,
Parameters options)
Retrieve a user's (or all users') images within any given container.
|
java.util.Set |
getImagesByOptions(Parameters options)
Retrieve images by options.
|
java.util.Map<java.lang.Long,java.util.Map<java.lang.Boolean,java.util.List<java.lang.Long>>> |
getImagesBySplitFilesets(java.util.Map<java.lang.Class<? extends IObject>,java.util.List<java.lang.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.
|
java.lang.Class<? extends ServiceInterface> |
getServiceInterface()
Returns the Interface implemented by this class.
|
java.util.Set |
getUserImages(Parameters options)
Retrieve a user's images.
|
ILink[] |
link(ILink[] arg0,
Parameters arg1)
Convenience method for creating links.
|
java.util.Set |
loadContainerHierarchy(java.lang.Class rootNodeType,
java.util.Set 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.
|
java.util.Collection |
retrieveCollection(IObject arg0,
java.lang.String arg1,
Parameters arg2)
Retrieves a collection with all members initialized ("loaded").
|
void |
unlink(ILink[] arg0,
Parameters arg1)
Removes links between OmeroDataObjects e.g Project-Dataset, Dataset-Image
Note that the objects themselves aren't deleted, only the Link objects.
|
IObject |
updateDataObject(IObject arg0,
Parameters arg1)
Updates a data object.
|
IObject[] |
updateDataObjects(IObject[] arg0,
Parameters arg1)
convenience method to save network calls.
|
getBeanHelper, getExtendedMetadata, getQueryFactory, getSecuritySystem, selfConfigure, setExtendedMetadata, setQueryFactory, setQueryService, setSecuritySystem, setUpdateService
public final java.lang.Class<? extends ServiceInterface> getServiceInterface()
getServiceInterface
in interface SelfConfigurableService
@Transactional(readOnly=true) public java.util.Set loadContainerHierarchy(java.lang.Class rootNodeType, java.util.Set rootNodeIds, Parameters options)
IContainer
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.
loadContainerHierarchy
in interface IContainer
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.
TODO should it be applied at all levels?rootNodeType
, unless orphan
is specified
in which case objects of type rootNodeType
and below
may be returned.@Transactional(readOnly=true) public java.util.Set findContainerHierarchies(java.lang.Class rootNodeType, java.util.Set imageIds, Parameters options)
IContainer
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
.
findContainerHierarchies
in interface IContainer
rootNodeType
- top-most type which will be searched for Can be
Project
. Not null.imageIds
- 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.
TODO decide on use of experimenter option@Transactional(readOnly=true) public java.util.Set getImages(java.lang.Class rootNodeType, java.util.Set rootNodeIds, Parameters options)
IContainer
getImages
in interface IContainer
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.Parameters.paginate(Integer, Integer)
,
Parameters.startTime(java.sql.Timestamp)
,
Parameters.endTime(java.sql.Timestamp)
@Transactional(readOnly=true) public java.util.Set getImagesByOptions(Parameters options)
IContainer
getImagesByOptions
in interface IContainer
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.@Transactional(readOnly=true) public java.util.Map<java.lang.Long,java.util.Map<java.lang.Boolean,java.util.List<java.lang.Long>>> getImagesBySplitFilesets(java.util.Map<java.lang.Class<? extends IObject>,java.util.List<java.lang.Long>> included, Parameters options)
IContainer
getImagesBySplitFilesets
in interface IContainer
included
- the entities includedoptions
- parameters, presently ignored@Transactional(readOnly=true) public java.util.Set getUserImages(Parameters options)
IContainer
getUserImages
in interface IContainer
options
- Parameters as above. No notion of leaves
.
experimenter|group
apply at the Image level and
must be present.@Transactional(readOnly=true) public java.util.Map getCollectionCount(java.lang.String type, java.lang.String property, java.util.Set ids, Parameters options)
IContainer
getCollectionCount
in interface IContainer
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.@Transactional(readOnly=true) public java.util.Collection retrieveCollection(IObject arg0, java.lang.String arg1, Parameters arg2)
IContainer
retrieveCollection
in interface IContainer
arg0
- Can be "unloaded".arg1
- public final static String
from the
IObject.classarg2
- Parameters. Unused.@Transactional(readOnly=false) public IObject createDataObject(IObject arg0, Parameters arg1)
IContainer
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
is
created.
createDataObject
in interface IContainer
arg0
- IObject. Supported: Project, Dataset,
Annotation, Group, Experimenter. Not null.arg1
- Parameters as above.@Transactional(readOnly=false) public IObject[] createDataObjects(IObject[] arg0, Parameters arg1)
IContainer
createDataObjects
in interface IContainer
arg0
- Array of Omero IObjects
arg1
- Parameters as above.IContainer.createDataObject(IObject, Parameters)
@Transactional(readOnly=false) public void unlink(ILink[] arg0, Parameters arg1)
IContainer
unlink
in interface IContainer
arg0
- Not null.arg1
- Parameters as above.@Transactional(readOnly=false) public ILink[] link(ILink[] arg0, Parameters arg1)
IContainer
IContainer.createDataObject(IObject, Parameters)
link
in interface IContainer
arg0
- Array of links to be created.arg1
- Parameters as above.@Transactional(readOnly=false) public IObject updateDataObject(IObject arg0, Parameters arg1)
IContainer
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
updateDataObject
in interface IContainer
arg0
- Pojos-based IObject. Supported: supported: Project, Dataset,
Annotation, Group, Experimenter.arg1
- Parameters as above.@Transactional(readOnly=false) public IObject[] updateDataObjects(IObject[] arg0, Parameters arg1)
IContainer
updateDataObjects
in interface IContainer
arg1
- Parameters as above.IContainer.updateDataObject(IObject, Parameters)
protected void checkType(java.lang.String type)
protected void checkProperty(java.lang.String type, java.lang.String property)
Version: 5.4.4-ice35-b82
Copyright © 2018 The University of Dundee & Open Microscopy Environment. All Rights Reserved.