Class GenericObjectWrapper<T extends DataObject>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected T data
      Wrapped object
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected GenericObjectWrapper​(T o)
      Constructor of the class GenericObjectWrapper.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T asDataObject()
      Returns the wrapped DataObject.
      boolean canAnnotate()
      Returns true if the object can be annotated false otherwise, depending on permissions level.
      boolean canChgrp()
      Returns true if the object can be moved by the user currently logged in, false otherwise, depending on permissions level.
      boolean canChown()
      Returns true if the object can be given by the user currently logged in, false otherwise, depending on permissions level.
      boolean canDelete()
      Returns true if the object can be deleted by the user currently logged in, false otherwise, depending on permissions level.
      boolean canEdit()
      Returns true if the object can be edited by the user currently logged in false otherwise, depending on permissions level.
      boolean canLink()
      Returns true if the object can be linked e.g.
      protected static void delete​(Client client, IObject object)
      Deletes an object from OMERO.
      static <T extends GenericObjectWrapper<?>>
      java.util.List<T>
      distinct​(java.util.Collection<? extends T> objects)
      Only keeps objects with different IDs in a collection.
      static <U extends GenericObjectWrapper<?>>
      java.util.List<U>
      flatten​(java.util.Collection<? extends java.util.Collection<? extends U>> lists)
      Flattens a collection of collections and only keeps objects with different IDs.
      java.sql.Timestamp getCreated()
      Gets the object creation date
      java.lang.Long getGroupId()
      Gets the group ID
      long getId()
      Gets the object id
      ExperimenterWrapper getOwner()
      Gets the owner ID
      void saveAndUpdate​(Client client)
      Saves and updates object.
      java.lang.String toString()
      Overridden to return the name of the class and the object id.
      protected static <U extends DataObject,​V extends GenericObjectWrapper<U>>
      java.util.List<V>
      wrap​(java.util.Collection<U> objects, java.util.function.Function<? super U,​? extends V> mapper)
      Converts a DataObject list to a ObjectWrapper list, sorted by sorter.
      protected static <U extends DataObject,​V extends GenericObjectWrapper<U>,​W extends java.lang.Comparable<W>>
      java.util.List<V>
      wrap​(java.util.Collection<U> objects, java.util.function.Function<? super U,​? extends V> mapper, java.util.function.Function<? super V,​? extends W> sorter)
      Converts a DataObject list to an ObjectWrapper list, sorted by sorter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • data

        protected T extends DataObject data
        Wrapped object
    • Constructor Detail

      • GenericObjectWrapper

        protected GenericObjectWrapper​(T o)
        Constructor of the class GenericObjectWrapper.
        Parameters:
        o - The DataObject to wrap in the GenericObjectWrapper.
    • Method Detail

      • wrap

        protected static <U extends DataObject,​V extends GenericObjectWrapper<U>,​W extends java.lang.Comparable<W>> java.util.List<V> wrap​(java.util.Collection<U> objects,
                                                                                                                                                       java.util.function.Function<? super U,​? extends V> mapper,
                                                                                                                                                       java.util.function.Function<? super V,​? extends W> sorter)
        Converts a DataObject list to an ObjectWrapper list, sorted by sorter.
        Type Parameters:
        U - The type of input (extends DataObject).
        V - The type of output (extends ObjectWrapper).
        W - The type used to sort the output.
        Parameters:
        objects - The DataObject list.
        mapper - The method used to map objects.
        sorter - The method used to sort the objects.
        Returns:
        See above.
      • wrap

        protected static <U extends DataObject,​V extends GenericObjectWrapper<U>> java.util.List<V> wrap​(java.util.Collection<U> objects,
                                                                                                               java.util.function.Function<? super U,​? extends V> mapper)
        Converts a DataObject list to a ObjectWrapper list, sorted by sorter.
        Type Parameters:
        U - The type of input (extends DataObject).
        V - The type of output (extends ObjectWrapper).
        Parameters:
        objects - The DataObject list.
        mapper - The method used to map objects.
        Returns:
        See above.
      • delete

        protected static void delete​(Client client,
                                     IObject object)
                              throws ServiceException,
                                     AccessException,
                                     java.util.concurrent.ExecutionException,
                                     OMEROServerError,
                                     java.lang.InterruptedException
        Deletes an object from OMERO.
        Parameters:
        client - The client handling the connection.
        object - The OMERO object.
        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.
      • distinct

        public static <T extends GenericObjectWrapper<?>> java.util.List<T> distinct​(java.util.Collection<? extends T> objects)
        Only keeps objects with different IDs in a collection.
        Type Parameters:
        T - The objects type.
        Parameters:
        objects - A collection of objects.
        Returns:
        Distinct objects list, sorted by ID.
      • flatten

        public static <U extends GenericObjectWrapper<?>> java.util.List<U> flatten​(java.util.Collection<? extends java.util.Collection<? extends U>> lists)
        Flattens a collection of collections and only keeps objects with different IDs.
        Type Parameters:
        U - The objects type.
        Parameters:
        lists - A collection of objects collections.
        Returns:
        Distinct objects list, sorted by ID.
      • asDataObject

        public T asDataObject()
        Returns the wrapped DataObject.
        Returns:
        An object of type GenericObjectWrapper.
      • getId

        public long getId()
        Gets the object id
        Returns:
        id.
      • getCreated

        public java.sql.Timestamp getCreated()
        Gets the object creation date
        Returns:
        creation date.
      • getGroupId

        public java.lang.Long getGroupId()
        Gets the group ID
        Returns:
        group id.
      • toString

        public java.lang.String toString()
        Overridden to return the name of the class and the object id.
        Overrides:
        toString in class java.lang.Object
      • saveAndUpdate

        public void saveAndUpdate​(Client client)
                           throws java.util.concurrent.ExecutionException,
                                  ServiceException,
                                  AccessException
        Saves and updates object.
        Parameters:
        client - The client handling the connection.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • canAnnotate

        public boolean canAnnotate()
        Returns true if the object can be annotated false otherwise, depending on permissions level.
        Returns:
        See above.
      • canEdit

        public boolean canEdit()
        Returns true if the object can be edited by the user currently logged in false otherwise, depending on permissions level.
        Returns:
        See above.
      • canLink

        public boolean canLink()
        Returns true if the object can be linked e.g. image add to dataset, by the user currently logged in, false otherwise, depending on permissions level.
        Returns:
        See above.
      • canDelete

        public boolean canDelete()
        Returns true if the object can be deleted by the user currently logged in, false otherwise, depending on permissions level.
        Returns:
        See above.
      • canChgrp

        public boolean canChgrp()
        Returns true if the object can be moved by the user currently logged in, false otherwise, depending on permissions level.
        Returns:
        See above.
      • canChown

        public boolean canChown()
        Returns true if the object can be given by the user currently logged in, false otherwise, depending on permissions level.
        Returns:
        See above.