Package omero.gateway.util
Class ModelMapper
- java.lang.Object
-
- omero.gateway.util.ModelMapper
-
public class ModelMapper extends java.lang.ObjectHelper class to mapDataObjects into their correspondingIObjects.- 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.ObjectconvertRTypeToJava(omero.RType type)Converts the passed OMERO type into its corresponding Java type.static omero.model.AnnotationcreateAnnotation(AnnotationData data)Creates a new annotationIObject.static omero.model.IObjectcreateAnnotationAndLink(omero.model.IObject annotatedObject, AnnotationData data)Creates a new annotationIObject.static omero.model.IObjectcreateIObject(DataObject child)Converts the specifiedDataObjectinto its correspondingIObject.static omero.model.IObjectcreateIObject(DataObject child, DataObject parent)Converts the specifiedDataObjectinto its correspondingIObject.static voidfillIObject(omero.model.IObject oldObject, omero.model.IObject newObject)Fills the new IObject with data from the old one.static omero.model.IObjectgetAnnotatedObject(omero.model.IObject annotation)Returns the annotated IObject related to the specified annotation.static omero.model.IObjectgetAnnotationObject(omero.model.IObject link)Returns the annotation represented by the specified linkstatic omero.model.IObjectgetChildFromLink(omero.model.IObject link)Returns the child from the passed link.static omero.model.IObjectgetParentFromLink(omero.model.IObject link)Returns the child from the passed link.static omero.model.IObjectlinkAnnotation(omero.model.IObject annotatedObject, omero.model.Annotation annotation)Links the annotation to the passed object.static omero.model.IObjectlinkParentToChild(omero.model.IObject child, omero.model.IObject parent)Links thechildto itsparent.static voidlinkParentToNewChild(omero.model.IObject child, omero.model.IObject parent)Links the newly createdchildto itsparent.static omero.model.IObjectremoveIObject(omero.model.IObject child, omero.model.IObject parent)Unlinks the specified child and the parent and returns the updated childIObject.static voidunloadCollections(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 thechildto 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 createdchildto 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 specifiedDataObjectinto its correspondingIObject.- Parameters:
child- The child to create.- Returns:
- The
IObjectto create.
-
createIObject
public static omero.model.IObject createIObject(DataObject child, DataObject parent)
Converts the specifiedDataObjectinto its correspondingIObject.- Parameters:
child- The child to create.parent- The child's parent.- Returns:
- The
IObjectto 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- TheDataObjectto annotate. Can either be aDatasetDataor 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.
-
-