Package fr.igred.omero
Class AnnotatableWrapper<T extends DataObject>
- java.lang.Object
-
- fr.igred.omero.ObjectWrapper<T>
-
- fr.igred.omero.AnnotatableWrapper<T>
-
- Type Parameters:
T
- Subclass ofDataObject
- All Implemented Interfaces:
Annotatable
,RemoteObject
- Direct Known Subclasses:
RepositoryObjectWrapper
,ROIWrapper
,ShapeWrapper
public abstract class AnnotatableWrapper<T extends DataObject> extends ObjectWrapper<T> implements Annotatable
Generic class containing an annotatable DataObject (or a subclass) object.
-
-
Field Summary
-
Fields inherited from class fr.igred.omero.ObjectWrapper
data
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AnnotatableWrapper(T o)
Constructor of the class RepositoryObjectWrapper.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description long
addAndReplaceFile(Client client, java.io.File file, ReplacePolicy policy)
Uploads a file, links it to the object and unlinks or deletes previous files with the same name.void
addAndReplaceTable(Client client, Table table, ReplacePolicy policy)
Adds a table to the object in OMERO and unlinks or deletes previous tables with the same name.void
addKeyValuePair(DataManager dm, java.lang.String key, java.lang.String value)
Adds a single Key-Value pair to the object.void
addTag(DataManager dm, java.lang.Long id)
Adds a tag to the object in OMERO, if possible.void
addTag(DataManager dm, java.lang.String name, java.lang.String description)
Adds a newly created tag to the object in OMERO, if possible.protected abstract java.lang.String
annotationLinkType()
Returns the type of annotation link for this object.java.util.List<Annotation>
getAnnotations(Browser browser)
Retrieves annotations linked to the object (of known types).java.util.List<FileAnnotation>
getFileAnnotations(Browser browser)
Returns the file annotationsjava.util.List<MapAnnotation>
getMapAnnotations(Browser browser)
Gets all map annotations linked to an object in OMERO, if possible.int
getMyRating(Browser browser)
Returns the user rating for this object (averaged if multiple ratings are linked).Table
getTable(DataManager dm, java.lang.Long fileId)
Gets a certain table linked to the object in OMERO.java.util.List<TagAnnotation>
getTags(Browser browser)
Gets all tags linked to an object in OMERO, if possible.void
rate(Client client, int rating)
Rates the object (using a rating annotation).protected void
removeLink(Client client, java.lang.String linkType, long childId)
Removes the link of the given type with the given child ID.<A extends Annotation>
voidunlink(Client client, A annotation)
Unlinks the given annotation from the current object.-
Methods inherited from class fr.igred.omero.ObjectWrapper
asDataObject, canAnnotate, canChgrp, canChown, canDelete, canEdit, canLink, getCreated, getGroupId, getId, getOwner, saveAndUpdate, toString, wrap, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface fr.igred.omero.Annotatable
addAndReplaceFile, addAndReplaceTable, addFile, addTable, addTags, copyAnnotationLinks, getAnnotationData, getKeyValuePairs, getTables, getValues, isLinked, link, link, linkIfNotLinked
-
Methods inherited from interface fr.igred.omero.RemoteObject
asDataObject, canAnnotate, canChgrp, canChown, canDelete, canEdit, canLink, getCreated, getGroupId, getId, getOwner, saveAndUpdate
-
-
-
-
Constructor Detail
-
AnnotatableWrapper
protected AnnotatableWrapper(T o)
Constructor of the class RepositoryObjectWrapper.- Parameters:
o
- The annotatable DataObject to wrap in the RepositoryObjectWrapper.
-
-
Method Detail
-
annotationLinkType
protected abstract java.lang.String annotationLinkType()
Returns the type of annotation link for this object.- Returns:
- See above.
-
addTag
public void addTag(DataManager dm, java.lang.String name, java.lang.String description) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Adds a newly created tag to the object in OMERO, if possible.- Specified by:
addTag
in interfaceAnnotatable
- Parameters:
dm
- The data manager.name
- Tag Name.description
- Tag description.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
addTag
public void addTag(DataManager dm, java.lang.Long id) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Adds a tag to the object in OMERO, if possible.- Specified by:
addTag
in interfaceAnnotatable
- Parameters:
dm
- The data manager.id
- ID of the tag to add to the object.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getTags
public java.util.List<TagAnnotation> getTags(Browser browser) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Gets all tags linked to an object in OMERO, if possible.- Specified by:
getTags
in interfaceAnnotatable
- Parameters:
browser
- The data browser.- Returns:
- See above.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getMapAnnotations
public java.util.List<MapAnnotation> getMapAnnotations(Browser browser) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Gets all map annotations linked to an object in OMERO, if possible.- Specified by:
getMapAnnotations
in interfaceAnnotatable
- Parameters:
browser
- The data browser.- Returns:
- See above.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
addKeyValuePair
public void addKeyValuePair(DataManager dm, java.lang.String key, java.lang.String value) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Adds a single Key-Value pair to the object.- Specified by:
addKeyValuePair
in interfaceAnnotatable
- Parameters:
dm
- The data manager.key
- Name of the key.value
- Value associated to the key.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
rate
public void rate(Client client, int rating) throws ServiceException, AccessException, java.util.concurrent.ExecutionException, ServerException, java.lang.InterruptedException
Rates the object (using a rating annotation).If multiple ratings are present, only one will be kept and updated.
- Specified by:
rate
in interfaceAnnotatable
- Parameters:
client
- The client handling the connection.rating
- The rating.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.ServerException
- Server error.java.lang.InterruptedException
- The thread was interrupted.
-
getMyRating
public int getMyRating(Browser browser) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Returns the user rating for this object (averaged if multiple ratings are linked).- Specified by:
getMyRating
in interfaceAnnotatable
- Parameters:
browser
- The data browser.- Returns:
- See above.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
addAndReplaceTable
public void addAndReplaceTable(Client client, Table table, ReplacePolicy policy) throws ServiceException, AccessException, java.util.concurrent.ExecutionException, ServerException, java.lang.InterruptedException
Adds a table to the object in OMERO and unlinks or deletes previous tables with the same name.- Specified by:
addAndReplaceTable
in interfaceAnnotatable
- Parameters:
client
- The client handling the connection.table
- Table to add to the object.policy
- Whether older tables should be unlinked, deleted or deleted only if they become orphaned.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.java.lang.InterruptedException
- The thread was interrupted.ServerException
- Server error.
-
getTable
public Table getTable(DataManager dm, java.lang.Long fileId) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Gets a certain table linked to the object in OMERO.- Specified by:
getTable
in interfaceAnnotatable
- Parameters:
dm
- The data manager.fileId
- FileId of the table researched.- Returns:
- See above.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
addAndReplaceFile
public long addAndReplaceFile(Client client, java.io.File file, ReplacePolicy policy) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, AccessException, ServiceException, ServerException
Uploads a file, links it to the object and unlinks or deletes previous files with the same name.- Specified by:
addAndReplaceFile
in interfaceAnnotatable
- Parameters:
client
- The client handling the connection.file
- File to add.policy
- Whether older files should be unlinked, deleted or deleted only if they become orphaned.- Returns:
- ID of the file created in OMERO.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.java.lang.InterruptedException
- The thread was interrupted.ServerException
- Server error.
-
getFileAnnotations
public java.util.List<FileAnnotation> getFileAnnotations(Browser browser) throws java.util.concurrent.ExecutionException, ServiceException, AccessException
Returns the file annotations- Specified by:
getFileAnnotations
in interfaceAnnotatable
- Parameters:
browser
- The data browser.- Returns:
- The list of tile annotations.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
unlink
public <A extends Annotation> void unlink(Client client, A annotation) throws ServiceException, AccessException, java.util.concurrent.ExecutionException, ServerException, java.lang.InterruptedException
Unlinks the given annotation from the current object.- Specified by:
unlink
in interfaceAnnotatable
- Type Parameters:
A
- The type of the annotation.- Parameters:
client
- The client handling the connection.annotation
- An annotation.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.ServerException
- Server error.java.lang.InterruptedException
- If block(long) does not return.
-
removeLink
protected void removeLink(Client client, java.lang.String linkType, long childId) throws ServiceException, ServerException, AccessException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
Removes the link of the given type with the given child ID.- Parameters:
client
- The client handling the connection.linkType
- The link type.childId
- Link child ID.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.ServerException
- Server error.java.lang.InterruptedException
- If block(long) does not return.
-
getAnnotations
public java.util.List<Annotation> getAnnotations(Browser browser) throws AccessException, ServiceException, java.util.concurrent.ExecutionException
Retrieves annotations linked to the object (of known types).- Specified by:
getAnnotations
in interfaceAnnotatable
- Parameters:
browser
- The data browser.- Returns:
- A list of annotations.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
-