Class Client


  • public class Client
    extends GatewayWrapper
    Basic class, contains the gateway, the security context, and multiple facilities.

    Allows the user to connect to OMERO and browse through all the data accessible to the user.

    • Constructor Detail

      • Client

        public Client()
        Constructor of the Client class. Initializes the gateway.
    • Method Detail

      • getProject

        public ProjectWrapper getProject​(java.lang.Long id)
                                  throws ServiceException,
                                         AccessException,
                                         java.util.concurrent.ExecutionException
        Gets the project with the specified id from OMERO.
        Parameters:
        id - ID of the project.
        Returns:
        ProjectWrapper containing the project.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.NoSuchElementException - No element with such id.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getProjects

        public java.util.List<ProjectWrapper> getProjects​(java.lang.Long... ids)
                                                   throws ServiceException,
                                                          AccessException,
                                                          java.util.concurrent.ExecutionException
        Gets the projects with the specified ids from OMERO.
        Parameters:
        ids - Project IDs
        Returns:
        List of ProjectWrappers.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getProjects

        public java.util.List<ProjectWrapper> getProjects()
                                                   throws ServiceException,
                                                          AccessException,
                                                          java.util.concurrent.ExecutionException
        Gets all projects available from OMERO.
        Returns:
        Collection of ProjectWrapper.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getProjects

        public java.util.List<ProjectWrapper> getProjects​(ExperimenterWrapper experimenter)
                                                   throws ServiceException,
                                                          AccessException,
                                                          java.util.concurrent.ExecutionException
        Gets all projects available from OMERO owned by a given user.
        Parameters:
        experimenter - The user.
        Returns:
        See above.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getProjects

        public java.util.List<ProjectWrapper> getProjects​(java.lang.String name)
                                                   throws ServiceException,
                                                          AccessException,
                                                          java.util.concurrent.ExecutionException
        Gets all projects with a certain name from OMERO.
        Parameters:
        name - Name searched.
        Returns:
        Collection of ProjectWrapper.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getDataset

        public DatasetWrapper getDataset​(java.lang.Long id)
                                  throws ServiceException,
                                         AccessException,
                                         java.util.concurrent.ExecutionException
        Gets the dataset with the specified id from OMERO.
        Parameters:
        id - ID of the dataset.
        Returns:
        ProjectWrapper containing the project.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.NoSuchElementException - No element with such id.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getDatasets

        public java.util.List<DatasetWrapper> getDatasets​(java.lang.Long... ids)
                                                   throws ServiceException,
                                                          AccessException,
                                                          java.util.concurrent.ExecutionException
        Gets the datasets with the specified ids from OMERO.
        Parameters:
        ids - Dataset IDs
        Returns:
        List of DatasetWrappers.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getDatasets

        public java.util.List<DatasetWrapper> getDatasets​(java.lang.String name)
                                                   throws ServiceException,
                                                          AccessException,
                                                          java.util.concurrent.ExecutionException
        Gets all datasets with a certain name from OMERO.
        Parameters:
        name - Name searched.
        Returns:
        Collection of DatasetWrapper.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getImage

        public ImageWrapper getImage​(java.lang.Long id)
                              throws ServiceException,
                                     AccessException,
                                     java.util.concurrent.ExecutionException
        Returns an ImageWrapper that contains the image with the specified id from OMERO.
        Parameters:
        id - ID of the image.
        Returns:
        ImageWrapper containing the image.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.NoSuchElementException - No element with such id.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getImages

        public java.util.List<ImageWrapper> getImages​(java.lang.Long... ids)
                                               throws ServiceException,
                                                      AccessException,
                                                      java.util.concurrent.ExecutionException
        Gets the images with the specified ids from OMERO
        Parameters:
        ids - Image IDs
        Returns:
        ImageWrapper list.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getImages

        public java.util.List<ImageWrapper> getImages()
                                               throws ServiceException,
                                                      AccessException,
                                                      java.util.concurrent.ExecutionException
        Gets all images owned by the current user.
        Returns:
        ImageWrapper list.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getImages

        public java.util.List<ImageWrapper> getImages​(java.lang.String name)
                                               throws ServiceException,
                                                      AccessException,
                                                      java.util.concurrent.ExecutionException
        Gets all images with a certain name from OMERO.
        Parameters:
        name - Name searched.
        Returns:
        ImageWrapper list.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getImages

        public java.util.List<ImageWrapper> getImages​(java.lang.String projectName,
                                                      java.lang.String datasetName,
                                                      java.lang.String imageName)
                                               throws ServiceException,
                                                      AccessException,
                                                      java.util.concurrent.ExecutionException
        Gets all images with the name specified inside projects and datasets with the given names.
        Parameters:
        projectName - Expected project name.
        datasetName - Expected dataset name.
        imageName - Expected image name.
        Returns:
        ImageWrapper list.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getImagesLike

        public java.util.List<ImageWrapper> getImagesLike​(java.lang.String motif)
                                                   throws ServiceException,
                                                          AccessException,
                                                          java.util.concurrent.ExecutionException
        Gets all images with a certain motif in their name from OMERO.
        Parameters:
        motif - Motif searched in an image name.
        Returns:
        See above.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getImagesTagged

        @Deprecated
        public java.util.List<ImageWrapper> getImagesTagged​(java.lang.Long tagId)
                                                     throws ServiceException,
                                                            AccessException,
                                                            OMEROServerError,
                                                            java.util.concurrent.ExecutionException
        Deprecated.
        Gets all images tagged with a specified tag from OMERO.
        Parameters:
        tagId - Id of the tag researched.
        Returns:
        See above.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        OMEROServerError - Server error.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getImagesKey

        @Deprecated
        public java.util.List<ImageWrapper> getImagesKey​(java.lang.String key)
                                                  throws ServiceException,
                                                         AccessException,
                                                         java.util.concurrent.ExecutionException
        Deprecated.
        Gets all images with a certain key
        Parameters:
        key - Name of the key researched.
        Returns:
        See above.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getImagesPairKeyValue

        @Deprecated
        public java.util.List<ImageWrapper> getImagesPairKeyValue​(java.lang.String key,
                                                                  java.lang.String value)
                                                           throws ServiceException,
                                                                  AccessException,
                                                                  java.util.concurrent.ExecutionException
        Deprecated.
        Gets all images with a certain key value pair from OMERO
        Parameters:
        key - Name of the key researched.
        value - Value associated with the key.
        Returns:
        See above.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getImagesWithKeyValuePair

        public java.util.List<ImageWrapper> getImagesWithKeyValuePair​(java.lang.String key,
                                                                      java.lang.String value)
                                                               throws ServiceException,
                                                                      AccessException,
                                                                      java.util.concurrent.ExecutionException,
                                                                      OMEROServerError
        Gets all images with a certain key value pair from OMERO
        Parameters:
        key - Name of the key researched.
        value - Value associated with the key.
        Returns:
        See above.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        OMEROServerError - Server error.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getScreen

        public ScreenWrapper getScreen​(java.lang.Long id)
                                throws ServiceException,
                                       AccessException,
                                       java.util.concurrent.ExecutionException
        Gets the screen with the specified id from OMERO.
        Parameters:
        id - ID of the screen.
        Returns:
        ScreenWrapper containing the screen.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.NoSuchElementException - No element with such id.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getScreens

        public java.util.List<ScreenWrapper> getScreens​(java.lang.Long... ids)
                                                 throws ServiceException,
                                                        AccessException,
                                                        java.util.concurrent.ExecutionException
        Gets the screens with the specified ids from OMERO.
        Parameters:
        ids - A list of screen ids
        Returns:
        List of ScreenWrappers.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getScreens

        public java.util.List<ScreenWrapper> getScreens()
                                                 throws ServiceException,
                                                        AccessException,
                                                        java.util.concurrent.ExecutionException
        Gets all screens available from OMERO.
        Returns:
        List of ScreenWrappers.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getScreens

        public java.util.List<ScreenWrapper> getScreens​(ExperimenterWrapper experimenter)
                                                 throws ServiceException,
                                                        AccessException,
                                                        java.util.concurrent.ExecutionException
        Gets all screens available from OMERO owned by a given user.
        Parameters:
        experimenter - The user.
        Returns:
        See above.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getPlate

        public PlateWrapper getPlate​(java.lang.Long id)
                              throws ServiceException,
                                     AccessException,
                                     java.util.concurrent.ExecutionException
        Gets the plate with the specified id from OMERO.
        Parameters:
        id - ID of the plate.
        Returns:
        PlateWrapper containing the plate.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.NoSuchElementException - No element with such id.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getPlates

        public java.util.List<PlateWrapper> getPlates​(java.lang.Long... ids)
                                               throws ServiceException,
                                                      AccessException,
                                                      java.util.concurrent.ExecutionException
        Gets the plates with the specified ids from OMERO.
        Parameters:
        ids - A list of plate ids
        Returns:
        List of PlateWrappers.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getPlates

        public java.util.List<PlateWrapper> getPlates()
                                               throws ServiceException,
                                                      AccessException,
                                                      java.util.concurrent.ExecutionException
        Gets all plates available from OMERO.
        Returns:
        List of PlateWrappers.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getPlates

        public java.util.List<PlateWrapper> getPlates​(ExperimenterWrapper experimenter)
                                               throws ServiceException,
                                                      AccessException,
                                                      java.util.concurrent.ExecutionException
        Gets all plates available from OMERO owned by a given user.
        Parameters:
        experimenter - The user.
        Returns:
        See above.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getWell

        public WellWrapper getWell​(java.lang.Long id)
                            throws ServiceException,
                                   AccessException,
                                   java.util.concurrent.ExecutionException
        Gets the well with the specified id from OMERO.
        Parameters:
        id - ID of the well.
        Returns:
        WellWrapper containing the well.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.NoSuchElementException - No element with such id.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getWells

        public java.util.List<WellWrapper> getWells​(java.lang.Long... ids)
                                             throws ServiceException,
                                                    AccessException,
                                                    java.util.concurrent.ExecutionException
        Gets the wells with the specified ids from OMERO.
        Parameters:
        ids - A list of well ids
        Returns:
        List of WellWrappers.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getFolder

        public FolderWrapper getFolder​(long id)
                                throws ServiceException,
                                       AccessException,
                                       java.util.concurrent.ExecutionException
        Gets the folder with the specified ID from OMERO, fully loaded.
        Parameters:
        id - ID of the folder.
        Returns:
        See above.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.NoSuchElementException - No element with such id.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getFolders

        public java.util.List<FolderWrapper> getFolders()
                                                 throws java.util.concurrent.ExecutionException,
                                                        AccessException,
                                                        ServiceException
        Gets all folders available from OMERO.
        Returns:
        See above.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getFolders

        public java.util.List<FolderWrapper> getFolders​(ExperimenterWrapper experimenter)
                                                 throws java.util.concurrent.ExecutionException,
                                                        AccessException,
                                                        ServiceException
        Gets all the folders owned by a given user from OMERO.
        Parameters:
        experimenter - The user.
        Returns:
        See above.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • loadFolders

        public java.util.List<FolderWrapper> loadFolders​(java.lang.Long... ids)
                                                  throws ServiceException,
                                                         AccessException,
                                                         java.util.concurrent.ExecutionException
        Gets the folders with the specified IDs from OMERO (fully loaded).
        Parameters:
        ids - Project IDs
        Returns:
        See above.
        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​(java.lang.String key,
                                                                      java.lang.String value)
                                                               throws OMEROServerError,
                                                                      ServiceException
        Gets the list of map annotations with the specified key and value available to the user.
        Parameters:
        key - The required key.
        value - The required value.
        Returns:
        See above.
        Throws:
        OMEROServerError - Server error.
        ServiceException - Cannot connect to OMERO.
      • getMapAnnotation

        public MapAnnotationWrapper getMapAnnotation​(java.lang.Long id)
                                              throws ServiceException,
                                                     java.util.concurrent.ExecutionException,
                                                     AccessException
        Gets a specific map annotation (key/value pairs) from the OMERO database.
        Parameters:
        id - ID of the map annotation.
        Returns:
        See above.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • delete

        public void delete​(java.util.Collection<? extends GenericObjectWrapper<?>> objects)
                    throws ServiceException,
                           AccessException,
                           java.util.concurrent.ExecutionException,
                           OMEROServerError,
                           java.lang.InterruptedException
        Deletes multiple objects from OMERO.
        Parameters:
        objects - 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.
      • delete

        public void delete​(TableWrapper table)
                    throws ServiceException,
                           AccessException,
                           java.util.concurrent.ExecutionException,
                           OMEROServerError,
                           java.lang.InterruptedException
        Deletes a table from OMERO
        Parameters:
        table - TableWrapper containing the table to delete.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
        java.lang.IllegalArgumentException - ID not defined.
        OMEROServerError - Server error.
        java.lang.InterruptedException - If block(long) does not return.
      • getUser

        public ExperimenterWrapper getUser​(java.lang.String username)
                                    throws java.util.concurrent.ExecutionException,
                                           ServiceException,
                                           AccessException
        Returns the user which matches the username.
        Parameters:
        username - The name of the user.
        Returns:
        The user matching the username, or null if it does not exist.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
        java.util.NoSuchElementException - The requested user does not exist.
      • getGroup

        public GroupWrapper getGroup​(java.lang.String groupName)
                              throws java.util.concurrent.ExecutionException,
                                     ServiceException,
                                     AccessException
        Returns the group which matches the name.
        Parameters:
        groupName - The name of the group.
        Returns:
        The group with the appropriate name, if it exists.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
        java.util.NoSuchElementException - The requested group does not exist.
      • sudoGetUser

        public Client sudoGetUser​(java.lang.String username)
                           throws ServiceException,
                                  AccessException,
                                  java.util.concurrent.ExecutionException
        Gets the client associated with the username in the parameters. The user calling this function needs to have administrator rights. All action realized with the client returned will be considered as his.
        Parameters:
        username - Username of user.
        Returns:
        The client corresponding to the new user.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
        java.util.NoSuchElementException - The requested user does not exist.