Package omero.gateway.util
Class ModelMapper
- java.lang.Object
-
- omero.gateway.util.ModelMapper
-
public class ModelMapper extends java.lang.Object
Helper class to mapDataObject
s into their correspondingIObject
s.- Since:
- OME2.2
-
-
Constructor Summary
Constructors Constructor Description ModelMapper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
convertRTypeToJava(omero.RType type)
Converts the passed OMERO type into its corresponding Java type.static omero.model.Annotation
createAnnotation(AnnotationData data)
Creates a new annotationIObject
.static omero.model.IObject
createAnnotationAndLink(omero.model.IObject annotatedObject, AnnotationData data)
Creates a new annotationIObject
.static omero.model.IObject
createIObject(DataObject child)
Converts the specifiedDataObject
into its correspondingIObject
.static omero.model.IObject
createIObject(DataObject child, DataObject parent)
Converts the specifiedDataObject
into its correspondingIObject
.static void
fillIObject(omero.model.IObject oldObject, omero.model.IObject newObject)
Fills the new IObject with data from the old one.static omero.model.IObject
getAnnotatedObject(omero.model.IObject annotation)
Returns the annotated IObject related to the specified annotation.static omero.model.IObject
getAnnotationObject(omero.model.IObject link)
Returns the annotation represented by the specified linkstatic omero.model.IObject
getChildFromLink(omero.model.IObject link)
Returns the child from the passed link.static omero.model.IObject
getParentFromLink(omero.model.IObject link)
Returns the child from the passed link.static omero.model.IObject
linkAnnotation(omero.model.IObject annotatedObject, omero.model.Annotation annotation)
Links the annotation to the passed object.static omero.model.IObject
linkParentToChild(omero.model.IObject child, omero.model.IObject parent)
Links thechild
to itsparent
.static void
linkParentToNewChild(omero.model.IObject child, omero.model.IObject parent)
Links the newly createdchild
to itsparent
.static omero.model.IObject
removeIObject(omero.model.IObject child, omero.model.IObject parent)
Unlinks the specified child and the parent and returns the updated childIObject
.static void
unloadCollections(omero.model.IObject object)
Unlinks the collections linked to the specifiedIObject
.
-
-
-
Method Detail
-
unloadCollections
public static void unloadCollections(omero.model.IObject object)
Unlinks the collections linked to the specifiedIObject
.- Parameters:
object
- The object.
-
getChildFromLink
public static omero.model.IObject getChildFromLink(omero.model.IObject link)
Returns the child from the passed link.- Parameters:
link
- The link to handle.- Returns:
- See above.
-
getParentFromLink
public static omero.model.IObject getParentFromLink(omero.model.IObject link)
Returns the child from the passed link.- Parameters:
link
- The link to handle.- Returns:
- See above.
-
linkParentToChild
public static omero.model.IObject linkParentToChild(omero.model.IObject child, omero.model.IObject parent)
Links thechild
to itsparent
.- Parameters:
child
- The child to handle.parent
- The parent to handle.- Returns:
- The link.
-
linkParentToNewChild
public static void linkParentToNewChild(omero.model.IObject child, omero.model.IObject parent)
Links the newly createdchild
to itsparent
. This method should only be invoked to add a newly created child.- Parameters:
child
- The newly created child.parent
- The parent of the newly created child.
-
createIObject
public static omero.model.IObject createIObject(DataObject child)
Converts the specifiedDataObject
into its correspondingIObject
.- Parameters:
child
- The child to create.- Returns:
- The
IObject
to create.
-
createIObject
public static omero.model.IObject createIObject(DataObject child, DataObject parent)
Converts the specifiedDataObject
into its correspondingIObject
.- Parameters:
child
- The child to create.parent
- The child's parent.- Returns:
- The
IObject
to create.
-
removeIObject
public static omero.model.IObject removeIObject(omero.model.IObject child, omero.model.IObject parent)
Unlinks the specified child and the parent and returns the updated childIObject
.- Parameters:
child
- The child to remove.parent
- The parent of the child.- Returns:
- See above.
-
createAnnotationAndLink
public static omero.model.IObject createAnnotationAndLink(omero.model.IObject annotatedObject, AnnotationData data)
Creates a new annotationIObject
.- Parameters:
annotatedObject
- TheDataObject
to annotate. Can either be aDatasetData
or aImageData
. Mustn't benull
.data
- The annotation to create.- Returns:
- See above.
-
createAnnotation
public static omero.model.Annotation createAnnotation(AnnotationData data)
Creates a new annotationIObject
.- Parameters:
data
- The annotation to create.- Returns:
- See above.
-
linkAnnotation
public static omero.model.IObject linkAnnotation(omero.model.IObject annotatedObject, omero.model.Annotation annotation)
Links the annotation to the passed object.- Parameters:
annotatedObject
- The object to annotate.annotation
- The annotation to link.- Returns:
- See above.
-
getAnnotatedObject
public static omero.model.IObject getAnnotatedObject(omero.model.IObject annotation)
Returns the annotated IObject related to the specified annotation.- Parameters:
annotation
- The annotation.- Returns:
- See above.
-
getAnnotationObject
public static omero.model.IObject getAnnotationObject(omero.model.IObject link)
Returns the annotation represented by the specified link- Parameters:
link
- The annotation.- Returns:
- See above.
-
fillIObject
public static void fillIObject(omero.model.IObject oldObject, omero.model.IObject newObject)
Fills the new IObject with data from the old one.- Parameters:
oldObject
- The old object.newObject
- The object to fill.
-
convertRTypeToJava
public static java.lang.Object convertRTypeToJava(omero.RType type)
Converts the passed OMERO type into its corresponding Java type.- Parameters:
type
- The type to handle.- Returns:
- See above.
-
-