Package fr.igred.omero
Class GenericObjectWrapper<T extends DataObject>
- java.lang.Object
-
- fr.igred.omero.GenericObjectWrapper<T>
-
- Type Parameters:
T
- Subclass ofDataObject
- Direct Known Subclasses:
AnnotatableWrapper
,ChannelWrapper
,ExperimenterWrapper
,GenericAnnotationWrapper
,GroupWrapper
,PixelsWrapper
,PlaneInfoWrapper
,WellSampleWrapper
public abstract class GenericObjectWrapper<T extends DataObject> extends Object
Generic class containing a DataObject (or a subclass) object.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GenericObjectWrapper(T o)
Constructor of the class GenericObjectWrapper.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description T
asDataObject()
Returns the wrapped DataObject.boolean
canAnnotate()
Returnstrue
if the object can be annotatedfalse
otherwise, depending on permissions level.boolean
canChgrp()
Returnstrue
if the object can be moved by the user currently logged in,false
otherwise, depending on permissions level.boolean
canChown()
Returnstrue
if the object can be given by the user currently logged in,false
otherwise, depending on permissions level.boolean
canDelete()
Returnstrue
if the object can be deleted by the user currently logged in,false
otherwise, depending on permissions level.boolean
canEdit()
Returnstrue
if the object can be edited by the user currently logged infalse
otherwise, depending on permissions level.boolean
canLink()
Returnstrue
if the object can be linked e.g.static <T extends GenericObjectWrapper<?>>
List<T>distinct(Collection<? extends T> objects)
Only keeps objects with different IDs in a collection.static <U extends GenericObjectWrapper<?>>
List<U>flatten(Collection<? extends Collection<? extends U>> lists)
Flattens a collection of collections and only keeps objects with different IDs.Timestamp
getCreated()
Gets the time when the object was created.Long
getGroupId()
Gets the group IDlong
getId()
Gets the object idExperimenterWrapper
getOwner()
Gets the owner IDTimestamp
getUpdated()
Gets the time when the object was last updated.void
saveAndUpdate(Client client)
Saves and updates object.String
toString()
Overridden to return the name of the class and the object id.protected static <U extends DataObject,V extends GenericObjectWrapper<U>>
List<V>wrap(Collection<U> objects, Function<? super U,? extends V> mapper)
Converts a DataObject list to a ObjectWrapper list, sorted bysorter
.protected static <U extends DataObject,V extends GenericObjectWrapper<U>,W extends Comparable<W>>
List<V>wrap(Collection<U> objects, Function<? super U,? extends V> mapper, Function<? super V,? extends W> sorter)
Converts a DataObject list to an ObjectWrapper list, sorted bysorter
.
-
-
-
Field Detail
-
data
protected T extends DataObject data
Wrapped object
-
-
Constructor Detail
-
GenericObjectWrapper
protected GenericObjectWrapper(T o)
Constructor of the class GenericObjectWrapper.- Parameters:
o
- The DataObject to wrap in the GenericObjectWrapper.
-
-
Method Detail
-
wrap
protected static <U extends DataObject,V extends GenericObjectWrapper<U>,W extends Comparable<W>> List<V> wrap(Collection<U> objects, Function<? super U,? extends V> mapper, Function<? super V,? extends W> sorter)
Converts a DataObject list to an ObjectWrapper list, sorted bysorter
.- Type Parameters:
U
- The type of input (extends DataObject).V
- The type of output (extends ObjectWrapper).W
- The type used to sort the output.- Parameters:
objects
- The DataObject list.mapper
- The method used to map objects.sorter
- The method used to sort the objects.- Returns:
- See above.
-
wrap
protected static <U extends DataObject,V extends GenericObjectWrapper<U>> List<V> wrap(Collection<U> objects, Function<? super U,? extends V> mapper)
Converts a DataObject list to a ObjectWrapper list, sorted bysorter
.- Type Parameters:
U
- The type of input (extends DataObject).V
- The type of output (extends ObjectWrapper).- Parameters:
objects
- The DataObject list.mapper
- The method used to map objects.- Returns:
- See above.
-
distinct
public static <T extends GenericObjectWrapper<?>> List<T> distinct(Collection<? extends T> objects)
Only keeps objects with different IDs in a collection.- Type Parameters:
T
- The objects type.- Parameters:
objects
- A collection of objects.- Returns:
- Distinct objects list, sorted by ID.
-
flatten
public static <U extends GenericObjectWrapper<?>> List<U> flatten(Collection<? extends Collection<? extends U>> lists)
Flattens a collection of collections and only keeps objects with different IDs.- Type Parameters:
U
- The objects type.- Parameters:
lists
- A collection of objects collections.- Returns:
- Distinct objects list, sorted by ID.
-
asDataObject
public T asDataObject()
Returns the wrapped DataObject.- Returns:
- An object of type
GenericObjectWrapper
.
-
getId
public long getId()
Gets the object id- Returns:
- id.
-
getCreated
public Timestamp getCreated()
Gets the time when the object was created.- Returns:
- See above.
-
getUpdated
public Timestamp getUpdated()
Gets the time when the object was last updated.- Returns:
- See above.
-
getOwner
public ExperimenterWrapper getOwner()
Gets the owner ID- Returns:
- owner id.
-
getGroupId
public Long getGroupId()
Gets the group ID- Returns:
- group id.
-
toString
public String toString()
Overridden to return the name of the class and the object id.
-
saveAndUpdate
public void saveAndUpdate(Client client) throws ExecutionException, ServiceException, AccessException
Saves and updates object.- Parameters:
client
- The client handling the connection.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
canAnnotate
public boolean canAnnotate()
Returnstrue
if the object can be annotatedfalse
otherwise, depending on permissions level.- Returns:
- See above.
-
canEdit
public boolean canEdit()
Returnstrue
if the object can be edited by the user currently logged infalse
otherwise, depending on permissions level.- Returns:
- See above.
-
canLink
public boolean canLink()
Returnstrue
if the object can be linked e.g. image add to dataset, by the user currently logged in,false
otherwise, depending on permissions level.- Returns:
- See above.
-
canDelete
public boolean canDelete()
Returnstrue
if the object can be deleted by the user currently logged in,false
otherwise, depending on permissions level.- Returns:
- See above.
-
canChgrp
public boolean canChgrp()
Returnstrue
if the object can be moved by the user currently logged in,false
otherwise, depending on permissions level.- Returns:
- See above.
-
canChown
public boolean canChown()
Returnstrue
if the object can be given by the user currently logged in,false
otherwise, depending on permissions level.- Returns:
- See above.
-
-