Package fr.igred.omero.repository
Class GenericRepositoryObjectWrapper<T extends DataObject>
- java.lang.Object
-
- fr.igred.omero.GenericObjectWrapper<T>
-
- fr.igred.omero.repository.GenericRepositoryObjectWrapper<T>
-
- Type Parameters:
T
- Subclass ofDataObject
- Direct Known Subclasses:
DatasetWrapper
,FolderWrapper
,ImageWrapper
,PlateAcquisitionWrapper
,PlateWrapper
,ProjectWrapper
,ScreenWrapper
,WellWrapper
public abstract class GenericRepositoryObjectWrapper<T extends DataObject> extends GenericObjectWrapper<T>
Generic class containing a DataObject (or a subclass) object.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GenericRepositoryObjectWrapper.ReplacePolicy
Policy to specify how to handle objects when they are replaced.
-
Field Summary
-
Fields inherited from class fr.igred.omero.GenericObjectWrapper
data
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GenericRepositoryObjectWrapper(T object)
Constructor of the class GenericRepositoryObjectWrapper.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description long
addAndReplaceFile(Client client, java.io.File file)
Uploads a file, links it to the object and unlinks previous files with the same name, or deletes them if they're orphaned.long
addAndReplaceFile(Client client, java.io.File file, GenericRepositoryObjectWrapper.ReplacePolicy policy)
Uploads a file, links it to the object and unlinks or deletes previous files with the same name.void
addAndReplaceTable(Client client, TableWrapper table)
Adds a table to the object in OMERO and unlinks previous tables with the same name, or deletes them if they're orphaned.void
addAndReplaceTable(Client client, TableWrapper table, GenericRepositoryObjectWrapper.ReplacePolicy policy)
Adds a table to the object in OMERO and unlinks or deletes previous tables with the same name.long
addFile(Client client, java.io.File file)
Uploads a file and links it to the objectvoid
addFileAnnotation(Client client, FileAnnotationWrapper annotation)
Links a file annotation to the objectvoid
addMapAnnotation(Client client, MapAnnotationWrapper mapAnnotation)
Adds a List of Key-Value pair to the object.void
addPairKeyValue(Client client, java.lang.String key, java.lang.String value)
Adds a single Key-Value pair to the object.void
addTable(Client client, TableWrapper table)
Adds a table to the object in OMERO.void
addTag(Client client, TagAnnotationWrapper tag)
Adds a tag to the object in OMERO, if possible.void
addTag(Client client, java.lang.Long id)
Adds multiple tags to the object in OMERO, if possible.void
addTag(Client client, java.lang.String name, java.lang.String description)
Adds a newly created tag to the object in OMERO, if possible.protected void
addTag(Client client, TagAnnotationData tagData)
Protected function.void
addTags(Client client, TagAnnotationWrapper... tags)
Adds multiple tag to the object in OMERO, if possible.void
addTags(Client client, java.lang.Long... ids)
Adds multiple tags by ID to the object in OMERO, if possible.protected abstract java.lang.String
annotationLinkType()
Returns the type of annotation link for this objectvoid
copyAnnotationLinks(Client client, GenericRepositoryObjectWrapper<?> object)
Copies annotation links from some other object to this oneabstract java.lang.String
getDescription()
Gets the object descriptionjava.util.List<FileAnnotationWrapper>
getFileAnnotations(Client client)
Returns the file annotationsjava.util.Map<java.lang.String,java.lang.String>
getKeyValuePairs(Client client)
Gets the List of NamedValue (Key-Value pair) associated to an object.java.util.List<MapAnnotationWrapper>
getMapAnnotations(Client client)
Gets all map annotations linked to an object in OMERO, if possible.abstract java.lang.String
getName()
Gets the object name.TableWrapper
getTable(Client client, java.lang.Long fileId)
Gets a certain table linked to the object in OMERO.java.util.List<TableWrapper>
getTables(Client client)
Gets all tables linked to the object in OMERO.java.util.List<TagAnnotationWrapper>
getTags(Client client)
Gets all tags linked to an object in OMERO, if possible.java.lang.String
getValue(Client client, java.lang.String key)
Gets the value from a Key-Value pair associated to the object.protected static java.util.List<java.lang.Long>
importImage(GatewayWrapper client, DataObject target, java.lang.String path)
Imports one image file to the target in OMERO.protected static boolean
importImages(GatewayWrapper client, DataObject target, java.lang.String... paths)
Imports all images candidates in the paths to the target in OMERO.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 GenericAnnotationWrapper<?>>
voidunlink(Client client, A annotation)
Unlinks the given annotation from the current object.-
Methods inherited from class fr.igred.omero.GenericObjectWrapper
canAnnotate, canChgrp, canChown, canDelete, canEdit, canLink, delete, distinct, getCreated, getGroupId, getId, getOwner, saveAndUpdate, toString, wrap, wrap
-
-
-
-
Constructor Detail
-
GenericRepositoryObjectWrapper
protected GenericRepositoryObjectWrapper(T object)
Constructor of the class GenericRepositoryObjectWrapper.- Parameters:
object
- The object contained in the GenericRepositoryObjectWrapper.
-
-
Method Detail
-
importImages
protected static boolean importImages(GatewayWrapper client, DataObject target, java.lang.String... paths) throws ServiceException, OMEROServerError, java.io.IOException
Imports all images candidates in the paths to the target in OMERO.- Parameters:
client
- The client handling the connection.target
- The import target.paths
- Paths to the image files on the computer.- Returns:
- If the import did not exit because of an error.
- Throws:
ServiceException
- Cannot connect to OMERO.OMEROServerError
- Server error.java.io.IOException
- Cannot read file.
-
importImage
protected static java.util.List<java.lang.Long> importImage(GatewayWrapper client, DataObject target, java.lang.String path) throws ServiceException, OMEROServerError
Imports one image file to the target in OMERO.- Parameters:
client
- The client handling the connection.target
- The import target.path
- Path to the image file on the computer.- Returns:
- The list of IDs of the newly imported images.
- Throws:
ServiceException
- Cannot connect to OMERO.OMEROServerError
- Server error.
-
annotationLinkType
protected abstract java.lang.String annotationLinkType()
Returns the type of annotation link for this object- Returns:
- See above.
-
getName
public abstract java.lang.String getName()
Gets the object name.- Returns:
- See above.
-
getDescription
public abstract java.lang.String getDescription()
Gets the object description- Returns:
- See above.
-
addTag
public void addTag(Client client, 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.- Parameters:
client
- The client handling the connection.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(Client client, TagAnnotationWrapper tag) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Adds a tag to the object in OMERO, if possible.- Parameters:
client
- The client handling the connection.tag
- Tag to be added.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
addTag
protected void addTag(Client client, TagAnnotationData tagData) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Protected function. Adds a tag to the object in OMERO, if possible.- Parameters:
client
- The client handling the connection.tagData
- Tag to be added.- 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(Client client, java.lang.Long id) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Adds multiple tags to the object in OMERO, if possible.- Parameters:
client
- The client handling the connection.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.
-
addTags
public void addTags(Client client, TagAnnotationWrapper... tags) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Adds multiple tag to the object in OMERO, if possible.- Parameters:
client
- The client handling the connection.tags
- Array of TagAnnotationWrapper to add.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
addTags
public void addTags(Client client, java.lang.Long... ids) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Adds multiple tags by ID to the object in OMERO, if possible.- Parameters:
client
- The client handling the connection.ids
- Array of tag id in OMERO to add.- 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<TagAnnotationWrapper> getTags(Client client) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Gets all tags linked to an object in OMERO, if possible.- Parameters:
client
- The client handling the connection.- Returns:
- List of TagAnnotationWrappers each containing a tag linked 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.
-
getMapAnnotations
public java.util.List<MapAnnotationWrapper> getMapAnnotations(Client client) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Gets all map annotations linked to an object in OMERO, if possible.- Parameters:
client
- The client handling the connection.- Returns:
- List of MapAnnotationWrappers.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
addPairKeyValue
public void addPairKeyValue(Client client, java.lang.String key, java.lang.String value) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Adds a single Key-Value pair to the object.- Parameters:
client
- The client handling the connection.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.
-
getKeyValuePairs
public java.util.Map<java.lang.String,java.lang.String> getKeyValuePairs(Client client) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Gets the List of NamedValue (Key-Value pair) associated to an object.- Parameters:
client
- The client handling the connection.- Returns:
- Collection of NamedValue.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getValue
public java.lang.String getValue(Client client, java.lang.String key) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Gets the value from a Key-Value pair associated to the object.- Parameters:
client
- The client handling the connection.key
- Key researched.- Returns:
- Value associated to the key.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.NoSuchElementException
- Key not found.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
addMapAnnotation
public void addMapAnnotation(Client client, MapAnnotationWrapper mapAnnotation) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Adds a List of Key-Value pair to the object.The list is contained in the MapAnnotationWrapper.
- Parameters:
client
- The client handling the connection.mapAnnotation
- MapAnnotationWrapper containing a list of NamedValue.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
addTable
public void addTable(Client client, TableWrapper table) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Adds a table to the object in OMERO.- Parameters:
client
- The client handling the connection.table
- Table 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.
-
addAndReplaceTable
public void addAndReplaceTable(Client client, TableWrapper table, GenericRepositoryObjectWrapper.ReplacePolicy policy) throws ServiceException, AccessException, java.util.concurrent.ExecutionException, OMEROServerError, java.lang.InterruptedException
Adds a table to the object in OMERO and unlinks or deletes previous tables with the same name.- 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.OMEROServerError
- Server error.
-
addAndReplaceTable
public void addAndReplaceTable(Client client, TableWrapper table) throws ServiceException, AccessException, java.util.concurrent.ExecutionException, OMEROServerError, java.lang.InterruptedException
Adds a table to the object in OMERO and unlinks previous tables with the same name, or deletes them if they're orphaned.- Parameters:
client
- The client handling the connection.table
- Table 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.java.lang.InterruptedException
- The thread was interrupted.OMEROServerError
- Server error.
-
getTable
public TableWrapper getTable(Client client, java.lang.Long fileId) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Gets a certain table linked to the object in OMERO.- Parameters:
client
- The client handling the connection.fileId
- FileId of the table researched.- Returns:
- TableWrapper containing the table information.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getTables
public java.util.List<TableWrapper> getTables(Client client) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Gets all tables linked to the object in OMERO.- Parameters:
client
- The client handling the connection.- Returns:
- List of TableWrappers containing the tables.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
addFile
public long addFile(Client client, java.io.File file) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Uploads a file and links it to the object- Parameters:
client
- The client handling the connection.file
- File to add.- Returns:
- ID of the file created in OMERO.
- Throws:
java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.java.lang.InterruptedException
- The thread was interrupted.
-
addAndReplaceFile
public long addAndReplaceFile(Client client, java.io.File file, GenericRepositoryObjectWrapper.ReplacePolicy policy) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, AccessException, ServiceException, OMEROServerError
Uploads a file, links it to the object and unlinks or deletes previous files with the same name.- 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.OMEROServerError
- Server error.
-
addAndReplaceFile
public long addAndReplaceFile(Client client, java.io.File file) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, AccessException, ServiceException, OMEROServerError
Uploads a file, links it to the object and unlinks previous files with the same name, or deletes them if they're orphaned.- Parameters:
client
- The client handling the connection.file
- File to add.- 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.OMEROServerError
- Server error.
-
addFileAnnotation
public void addFileAnnotation(Client client, FileAnnotationWrapper annotation) throws AccessException, ServiceException, java.util.concurrent.ExecutionException
Links a file annotation to the object- Parameters:
client
- The client handling the connection.annotation
- FileAnnotationWrapper to link.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getFileAnnotations
public java.util.List<FileAnnotationWrapper> getFileAnnotations(Client client) throws java.util.concurrent.ExecutionException, ServiceException, AccessException
Returns the file annotations- Parameters:
client
- The client handling the connection.- 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 GenericAnnotationWrapper<?>> void unlink(Client client, A annotation) throws ServiceException, AccessException, java.util.concurrent.ExecutionException, OMEROServerError, java.lang.InterruptedException
Unlinks the given annotation from the current object.- 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.OMEROServerError
- 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, OMEROServerError, 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.OMEROServerError
- Server error.java.lang.InterruptedException
- If block(long) does not return.
-
copyAnnotationLinks
public void copyAnnotationLinks(Client client, GenericRepositoryObjectWrapper<?> object) throws AccessException, ServiceException, java.util.concurrent.ExecutionException
Copies annotation links from some other object to this one- Parameters:
client
- The client handling the connection.object
- Other repository object to copy annotations from.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.java.util.concurrent.ExecutionException
- A Facility can't be retrieved or instantiated.
-
-