Class ModelMapper


  • public class ModelMapper
    extends java.lang.Object
    Helper class to map DataObjects into their corresponding IObjects.
    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 annotation IObject.
      static omero.model.IObject createAnnotationAndLink​(omero.model.IObject annotatedObject, AnnotationData data)
      Creates a new annotation IObject.
      static omero.model.IObject createIObject​(DataObject child)
      Converts the specified DataObject into its corresponding IObject.
      static omero.model.IObject createIObject​(DataObject child, DataObject parent)
      Converts the specified DataObject into its corresponding IObject.
      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 link
      static 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 the child to its parent.
      static void linkParentToNewChild​(omero.model.IObject child, omero.model.IObject parent)
      Links the newly created child to its parent.
      static omero.model.IObject removeIObject​(omero.model.IObject child, omero.model.IObject parent)
      Unlinks the specified child and the parent and returns the updated child IObject.
      static void unloadCollections​(omero.model.IObject object)
      Unlinks the collections linked to the specified IObject.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ModelMapper

        public ModelMapper()
    • Method Detail

      • unloadCollections

        public static void unloadCollections​(omero.model.IObject object)
        Unlinks the collections linked to the specified IObject.
        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 the child to its parent.
        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 created child to its parent. 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 specified DataObject into its corresponding IObject.
        Parameters:
        child - The child to create.
        Returns:
        The IObject to create.
      • createIObject

        public static omero.model.IObject createIObject​(DataObject child,
                                                        DataObject parent)
        Converts the specified DataObject into its corresponding IObject.
        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 child IObject.
        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 annotation IObject.
        Parameters:
        annotatedObject - The DataObject to annotate. Can either be a DatasetData or a ImageData. Mustn't be null.
        data - The annotation to create.
        Returns:
        See above.
      • createAnnotation

        public static omero.model.Annotation createAnnotation​(AnnotationData data)
        Creates a new annotation IObject.
        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.