Package fr.igred.omero
Class ObjectWrapper<T extends DataObject>
- java.lang.Object
-
- fr.igred.omero.ObjectWrapper<T>
-
- Type Parameters:
T
- Subclass ofDataObject
- All Implemented Interfaces:
RemoteObject
- Direct Known Subclasses:
AnnotatableWrapper
,AnnotationWrapper
,ChannelWrapper
,ExperimenterWrapper
,GroupWrapper
,PixelsWrapper
,PlaneInfoWrapper
,WellSampleWrapper
public abstract class ObjectWrapper<T extends DataObject> extends java.lang.Object implements RemoteObject
Generic class containing a DataObject (or a subclass) object.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ObjectWrapper(T o)
Constructor of the class ObjectWrapper.
-
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.java.sql.Timestamp
getCreated()
Gets the object creation datejava.lang.Long
getGroupId()
Gets the group IDlong
getId()
Gets the object idExperimenter
getOwner()
Gets the owner IDvoid
saveAndUpdate(DataManager dm)
Saves and updates object.java.lang.String
toString()
Overridden to return the name of the class and the object id.static <U extends DataObject,V extends RemoteObject>
java.util.List<V>wrap(java.util.Collection<U> objects, java.util.function.Function<? super U,? extends V> mapper)
Converts a DataObject list to a ObjectWrapper list, sorted bysorter
.static <U extends DataObject,V extends RemoteObject,W extends java.lang.Comparable<W>>
java.util.List<V>wrap(java.util.Collection<U> objects, java.util.function.Function<? super U,? extends V> mapper, java.util.function.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
-
ObjectWrapper
protected ObjectWrapper(T o)
Constructor of the class ObjectWrapper.- Parameters:
o
- The DataObject to wrap in the ObjectWrapper.
-
-
Method Detail
-
wrap
public static <U extends DataObject,V extends RemoteObject,W extends java.lang.Comparable<W>> java.util.List<V> wrap(java.util.Collection<U> objects, java.util.function.Function<? super U,? extends V> mapper, java.util.function.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
public static <U extends DataObject,V extends RemoteObject> java.util.List<V> wrap(java.util.Collection<U> objects, java.util.function.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.
-
asDataObject
public T asDataObject()
Returns the wrapped DataObject.- Specified by:
asDataObject
in interfaceRemoteObject
- Returns:
- An object of type
ObjectWrapper
.
-
getId
public long getId()
Gets the object id- Specified by:
getId
in interfaceRemoteObject
- Returns:
- id.
-
getCreated
public java.sql.Timestamp getCreated()
Gets the object creation date- Specified by:
getCreated
in interfaceRemoteObject
- Returns:
- creation date.
-
getOwner
public Experimenter getOwner()
Gets the owner ID- Specified by:
getOwner
in interfaceRemoteObject
- Returns:
- owner id.
-
getGroupId
public java.lang.Long getGroupId()
Gets the group ID- Specified by:
getGroupId
in interfaceRemoteObject
- Returns:
- group id.
-
toString
public java.lang.String toString()
Overridden to return the name of the class and the object id.- Overrides:
toString
in classjava.lang.Object
-
saveAndUpdate
public void saveAndUpdate(DataManager dm) throws java.util.concurrent.ExecutionException, ServiceException, AccessException
Saves and updates object.- Specified by:
saveAndUpdate
in interfaceRemoteObject
- Parameters:
dm
- The data manager.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.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.- Specified by:
canAnnotate
in interfaceRemoteObject
- 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.- Specified by:
canEdit
in interfaceRemoteObject
- 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.- Specified by:
canLink
in interfaceRemoteObject
- 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.- Specified by:
canDelete
in interfaceRemoteObject
- 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.- Specified by:
canChgrp
in interfaceRemoteObject
- 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.- Specified by:
canChown
in interfaceRemoteObject
- Returns:
- See above.
-
-