diff --git a/src/main/java/fr/igred/omero/AnnotatableWrapper.java b/src/main/java/fr/igred/omero/AnnotatableWrapper.java index a2739bb2..f397426b 100644 --- a/src/main/java/fr/igred/omero/AnnotatableWrapper.java +++ b/src/main/java/fr/igred/omero/AnnotatableWrapper.java @@ -107,7 +107,7 @@ public > boolean isLinked(Browser browser, A anno /** * Attach an {@link AnnotationData} to this object. * - * @param client The client handling the connection. + * @param dm The data manager. * @param annotation The {@link AnnotationData}. * @param The type of the annotation. * @@ -115,11 +115,11 @@ public > boolean isLinked(Browser browser, A anno * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - protected void link(DataManager client, A annotation) + protected void link(DataManager dm, A annotation) throws ServiceException, AccessException, ExecutionException { String error = String.format("Cannot add %s to %s", annotation, this); - call(client.getDMFacility(), - d -> d.attachAnnotation(client.getCtx(), annotation, data), + call(dm.getDMFacility(), + d -> d.attachAnnotation(dm.getCtx(), annotation, data), error); } @@ -127,7 +127,7 @@ protected void link(DataManager client, A annotation) /** * Adds an annotation to the object in OMERO, if possible (and if it's not a TagSet). * - * @param client The client handling the connection. + * @param dm The data manager. * @param annotation Annotation to be added. * @param The type of the annotation. * @@ -135,10 +135,10 @@ protected void link(DataManager client, A annotation) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public > void link(DataManager client, A annotation) + public > void link(DataManager dm, A annotation) throws ServiceException, AccessException, ExecutionException { if (!(annotation instanceof TagAnnotationWrapper) || !((TagAnnotationWrapper) annotation).isTagSet()) { - link(client, annotation.asDataObject()); + link(dm, annotation.asDataObject()); } else { String msg = "Tag sets should only be linked to tags"; throw new IllegalArgumentException(msg); @@ -149,17 +149,17 @@ public > void link(DataManager client, A annotati /** * Adds multiple annotations to the object in OMERO, if possible. * - * @param client The client handling the connection. + * @param dm The data manager. * @param annotations Annotations to add. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void link(DataManager client, AnnotationWrapper... annotations) + public void link(DataManager dm, AnnotationWrapper... annotations) throws ServiceException, AccessException, ExecutionException { for (AnnotationWrapper annotation : annotations) { - link(client, annotation); + link(dm, annotation); } } @@ -188,7 +188,7 @@ public void linkIfNotLinked(Client client, AnnotationWrapper... annotations) /** * Adds a newly created tag to the object in OMERO, if possible. * - * @param client The client handling the connection. + * @param dm The data manager. * @param name Tag Name. * @param description Tag description. * @@ -196,46 +196,46 @@ public void linkIfNotLinked(Client client, AnnotationWrapper... annotations) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void addTag(DataManager client, String name, String description) + public void addTag(DataManager dm, String name, String description) throws ServiceException, AccessException, ExecutionException { TagAnnotationWrapper tag = new TagAnnotationWrapper(new TagAnnotationData(name)); tag.setDescription(description); - link(client, tag); + link(dm, tag); } /** * Adds a tag to the object in OMERO, if possible. * - * @param client The client handling the connection. - * @param id ID of the tag to add to the object. + * @param dm The data manager. + * @param id ID of the tag to add to the object. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void addTag(DataManager client, Long id) + public void addTag(DataManager dm, Long id) throws ServiceException, AccessException, ExecutionException { TagAnnotationI tag = new TagAnnotationI(id, false); TagAnnotationData tagData = new TagAnnotationData(tag); - link(client, tagData); + link(dm, tagData); } /** * Adds multiple tags by ID to the object in OMERO, if possible. * - * @param client The client handling the connection. - * @param ids Array of tag id in OMERO to add. + * @param dm The data manager. + * @param ids Array of tag id in OMERO to add. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void addTags(DataManager client, Long... ids) + public void addTags(DataManager dm, Long... ids) throws ServiceException, AccessException, ExecutionException { for (Long id : ids) { - addTag(client, id); + addTag(dm, id); } } @@ -305,18 +305,18 @@ public List getMapAnnotations(Browser browser) /** * Adds a single Key-Value pair to the object. * - * @param client The client handling the connection. - * @param key Name of the key. - * @param value Value associated to the key. + * @param dm The data manager. + * @param key Name of the key. + * @param value Value associated to the key. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void addKeyValuePair(DataManager client, String key, String value) + public void addKeyValuePair(DataManager dm, String key, String value) throws ServiceException, AccessException, ExecutionException { MapAnnotationWrapper pkv = new MapAnnotationWrapper(key, value); - link(client, pkv); + link(dm, pkv); } @@ -474,27 +474,27 @@ public int getMyRating(Browser browser) /** * Adds a table to the object in OMERO. * - * @param client The client handling the connection. - * @param table Table to add to the object. + * @param dm The data manager. + * @param table Table to add to the object. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void addTable(DataManager client, TableWrapper table) + public void addTable(DataManager dm, TableWrapper table) throws ServiceException, AccessException, ExecutionException { String error = "Cannot add table to " + this; - TablesFacility tablesFacility = client.getTablesFacility(); + TablesFacility tablesFacility = dm.getTablesFacility(); TableData tableData = call(tablesFacility, - tf -> tf.addTable(client.getCtx(), + tf -> tf.addTable(dm.getCtx(), data, table.getName(), table.createTable()), error); Collection tables = call(tablesFacility, - tf -> tf.getAvailableTables(client.getCtx(), + tf -> tf.getAvailableTables(dm.getCtx(), data), error); long fileId = tableData.getOriginalFileId(); @@ -563,7 +563,7 @@ public void addAndReplaceTable(Client client, TableWrapper table) /** * Gets a certain table linked to the object in OMERO. * - * @param client The client handling the connection. + * @param dm The data manager. * @param fileId FileId of the table researched. * * @return See above. @@ -572,18 +572,18 @@ public void addAndReplaceTable(Client client, TableWrapper table) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public TableWrapper getTable(DataManager client, Long fileId) + public TableWrapper getTable(DataManager dm, Long fileId) throws ServiceException, AccessException, ExecutionException { - TableData info = call(client.getTablesFacility(), - tf -> tf.getTableInfo(client.getCtx(), fileId), + TableData info = call(dm.getTablesFacility(), + tf -> tf.getTableInfo(dm.getCtx(), fileId), "Cannot get table from " + this); long nRows = info.getNumberOfRows(); - TableData table = call(client.getTablesFacility(), - tf -> tf.getTable(client.getCtx(), fileId, + TableData table = call(dm.getTablesFacility(), + tf -> tf.getTable(dm.getCtx(), fileId, 0, nRows - 1), "Cannot get table from " + this); - String name = call(client.getTablesFacility(), - tf -> tf.getAvailableTables(client.getCtx(), data) + String name = call(dm.getTablesFacility(), + tf -> tf.getAvailableTables(dm.getCtx(), data) .stream() .filter(t -> t.getFileID() == fileId) .map(FileAnnotationData::getDescription) @@ -599,7 +599,7 @@ public TableWrapper getTable(DataManager client, Long fileId) /** * Gets all tables linked to the object in OMERO. * - * @param client The client handling the connection. + * @param dm The data manager. * * @return See above. * @@ -607,15 +607,15 @@ public TableWrapper getTable(DataManager client, Long fileId) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getTables(DataManager client) + public List getTables(DataManager dm) throws ServiceException, AccessException, ExecutionException { - Collection tables = call(client.getTablesFacility(), - tf -> tf.getAvailableTables(client.getCtx(), data), + Collection tables = call(dm.getTablesFacility(), + tf -> tf.getAvailableTables(dm.getCtx(), data), "Cannot get tables from " + this); List tablesWrapper = new ArrayList<>(tables.size()); for (FileAnnotationData table : tables) { - TableWrapper tableWrapper = getTable(client, table.getFileID()); + TableWrapper tableWrapper = getTable(dm, table.getFileID()); tableWrapper.setId(table.getId()); tablesWrapper.add(tableWrapper); } @@ -627,21 +627,21 @@ public List getTables(DataManager client) /** * Uploads a file and links it to the object * - * @param client The client handling the connection. - * @param file File to add. + * @param dm The data manager. + * @param file File to add. * * @return ID of the file created in OMERO. * * @throws ExecutionException A Facility can't be retrieved or instantiated. * @throws InterruptedException The thread was interrupted. */ - public long addFile(DataManager client, File file) + public long addFile(DataManager dm, File file) throws ExecutionException, InterruptedException { String name = file.getName(); - return client.getDMFacility() - .attachFile(client.getCtx(), file, null, "", name, data) - .get() - .getId(); + return dm.getDMFacility() + .attachFile(dm.getCtx(), file, null, "", name, data) + .get() + .getId(); } diff --git a/src/main/java/fr/igred/omero/ObjectWrapper.java b/src/main/java/fr/igred/omero/ObjectWrapper.java index fb39b411..f970080e 100644 --- a/src/main/java/fr/igred/omero/ObjectWrapper.java +++ b/src/main/java/fr/igred/omero/ObjectWrapper.java @@ -206,17 +206,17 @@ public String toString() { /** * Saves and updates object. * - * @param client The client handling the connection. + * @param dm The data manager. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ @SuppressWarnings("unchecked") - public void saveAndUpdate(DataManager client) + public void saveAndUpdate(DataManager dm) throws ExecutionException, ServiceException, AccessException { - data = (T) call(client.getDMFacility(), - d -> d.saveAndReturnObject(client.getCtx(), data), + data = (T) call(dm.getDMFacility(), + d -> d.saveAndReturnObject(dm.getCtx(), data), "Cannot save and update object."); } diff --git a/src/main/java/fr/igred/omero/RepositoryObjectWrapper.java b/src/main/java/fr/igred/omero/RepositoryObjectWrapper.java index f2f48e3c..0ba87e60 100644 --- a/src/main/java/fr/igred/omero/RepositoryObjectWrapper.java +++ b/src/main/java/fr/igred/omero/RepositoryObjectWrapper.java @@ -112,7 +112,7 @@ private static List importCandidates(DataObject target, ImportLibrary li /** * Imports all images candidates in the paths to the target in OMERO. * - * @param client The client handling the connection. + * @param conn The connection handler. * @param target The import target. * @param threads The number of threads (same value used for filesets and uploads). * @param paths Paths to the image files on the computer. @@ -123,19 +123,19 @@ private static List importCandidates(DataObject target, ImportLibrary li * @throws AccessException Cannot access data. * @throws IOException Cannot read file. */ - protected static boolean importImages(ConnectionHandler client, DataObject target, int threads, String... paths) + protected static boolean importImages(ConnectionHandler conn, DataObject target, int threads, String... paths) throws ServiceException, AccessException, IOException { boolean success; ImportConfig config = new ImportConfig(); String type = PojoMapper.getGraphType(target.getClass()); config.target.set(type + ":" + target.getId()); - config.username.set(client.getUser().getUserName()); - config.email.set(client.getUser().getEmail()); + config.username.set(conn.getUser().getUserName()); + config.email.set(conn.getUser().getEmail()); config.parallelFileset.set(threads); config.parallelUpload.set(threads); - OMEROMetadataStoreClient store = client.getImportStore(); + OMEROMetadataStoreClient store = conn.getImportStore(); try (OMEROWrapper reader = new OMEROWrapper(config)) { ExceptionHandler.ofConsumer(store, s -> s.logVersionInfo(config.getIniVersionNumber())) .handleServerAndService("Cannot log version information during import.") @@ -150,7 +150,7 @@ protected static boolean importImages(ConnectionHandler client, DataObject targe ImportCandidates candidates = new ImportCandidates(reader, paths, handler); success = library.importCandidates(config, candidates); } finally { - client.closeImport(); + conn.closeImport(); } return success; @@ -160,7 +160,7 @@ protected static boolean importImages(ConnectionHandler client, DataObject targe /** * Imports one image file to the target in OMERO. * - * @param client The client handling the connection. + * @param conn The connection handler. * @param target The import target. * @param path Path to the image file on the computer. * @@ -170,17 +170,17 @@ protected static boolean importImages(ConnectionHandler client, DataObject targe * @throws AccessException Cannot access data. * @throws IOException Cannot read file. */ - protected static List importImage(ConnectionHandler client, DataObject target, String path) + protected static List importImage(ConnectionHandler conn, DataObject target, String path) throws ServiceException, AccessException, IOException { ImportConfig config = new ImportConfig(); String type = PojoMapper.getGraphType(target.getClass()); config.target.set(type + ":" + target.getId()); - config.username.set(client.getUser().getUserName()); - config.email.set(client.getUser().getEmail()); + config.username.set(conn.getUser().getUserName()); + config.email.set(conn.getUser().getEmail()); Collection pixels; - OMEROMetadataStoreClient store = client.getImportStore(); + OMEROMetadataStoreClient store = conn.getImportStore(); try (OMEROWrapper reader = new OMEROWrapper(config)) { ExceptionHandler.ofConsumer(store, s -> s.logVersionInfo(config.getIniVersionNumber())) .handleServerAndService("Cannot log version information during import.") @@ -195,7 +195,7 @@ protected static List importImage(ConnectionHandler client, DataObject tar ImportCandidates candidates = new ImportCandidates(reader, new String[]{path}, handler); pixels = importCandidates(target, library, config, candidates); } finally { - client.closeImport(); + conn.closeImport(); } return pixels.stream() diff --git a/src/main/java/fr/igred/omero/annotations/TagAnnotationWrapper.java b/src/main/java/fr/igred/omero/annotations/TagAnnotationWrapper.java index 2cd49fa5..f47fdae5 100644 --- a/src/main/java/fr/igred/omero/annotations/TagAnnotationWrapper.java +++ b/src/main/java/fr/igred/omero/annotations/TagAnnotationWrapper.java @@ -51,7 +51,7 @@ public TagAnnotationWrapper(TagAnnotationData tag) { /** * Constructor of the TagAnnotationWrapper class. Creates the tag and saves it to OMERO. * - * @param client The client handling the connection. + * @param dm The data manager. * @param name Annotation name. * @param description Tag description. * @@ -59,10 +59,10 @@ public TagAnnotationWrapper(TagAnnotationData tag) { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public TagAnnotationWrapper(DataManager client, String name, String description) + public TagAnnotationWrapper(DataManager dm, String name, String description) throws ServiceException, AccessException, ExecutionException { super(new TagAnnotationData(name, description)); - super.saveAndUpdate(client); + super.saveAndUpdate(dm); } diff --git a/src/main/java/fr/igred/omero/client/ConnectionHandler.java b/src/main/java/fr/igred/omero/client/ConnectionHandler.java index 9421d1d8..8b072d5a 100644 --- a/src/main/java/fr/igred/omero/client/ConnectionHandler.java +++ b/src/main/java/fr/igred/omero/client/ConnectionHandler.java @@ -31,6 +31,8 @@ import java.util.NoSuchElementException; import java.util.concurrent.ExecutionException; +import static java.lang.String.valueOf; + /** * Interface to handle the connection to an OMERO server through a {@link Gateway} for a given user and in a specific @@ -140,7 +142,7 @@ default void connect(String hostname, int port, String sessionId) default void connect(String hostname, int port, String username, char[] password, Long groupID) throws ServiceException { LoginCredentials cred = new LoginCredentials(username, - String.valueOf(password), + valueOf(password), hostname, port); cred.setGroupID(groupID); @@ -163,7 +165,7 @@ default void connect(String hostname, int port, String username, char[] password default void connect(String hostname, int port, String username, char[] password) throws ServiceException { connect(new LoginCredentials(username, - String.valueOf(password), + valueOf(password), hostname, port)); } diff --git a/src/main/java/fr/igred/omero/containers/DatasetWrapper.java b/src/main/java/fr/igred/omero/containers/DatasetWrapper.java index c45a0406..ba523e10 100644 --- a/src/main/java/fr/igred/omero/containers/DatasetWrapper.java +++ b/src/main/java/fr/igred/omero/containers/DatasetWrapper.java @@ -368,17 +368,17 @@ public List getImagesWithKeyValuePair(Browser browser, String key, /** * Adds a list of image to the dataset in OMERO. * - * @param client The client handling the connection. + * @param dm The data manager. * @param images Image to add to the dataset. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void addImages(DataManager client, Iterable images) + public void addImages(DataManager dm, Iterable images) throws ServiceException, AccessException, ExecutionException { for (ImageWrapper image : images) { - addImage(client, image); + addImage(dm, image); } } @@ -386,19 +386,19 @@ public void addImages(DataManager client, Iterable image /** * Adds a single image to the dataset in OMERO * - * @param client The client handling the connection. - * @param image Image to add. + * @param dm The data manager. + * @param image Image to add. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void addImage(DataManager client, ImageWrapper image) + public void addImage(DataManager dm, ImageWrapper image) throws ServiceException, AccessException, ExecutionException { DatasetImageLink link = new DatasetImageLinkI(); link.setChild(image.asDataObject().asImage()); link.setParent(new DatasetI(data.getId(), false)); - client.save(link); + dm.save(link); } @@ -422,8 +422,8 @@ public void removeImage(Client client, ImageWrapper image) /** * Imports all images candidates in the paths to the dataset in OMERO. * - * @param client The client handling the connection. - * @param paths Paths to the image files on the computer. + * @param conn The connection handler. + * @param paths Paths to the image files on the computer. * * @return If the import did not exit because of an error. * @@ -431,16 +431,16 @@ public void removeImage(Client client, ImageWrapper image) * @throws AccessException Cannot access data. * @throws IOException Cannot read file. */ - public boolean importImages(ConnectionHandler client, String... paths) + public boolean importImages(ConnectionHandler conn, String... paths) throws ServiceException, AccessException, IOException { - return importImages(client, 1, paths); + return importImages(conn, 1, paths); } /** * Imports all images candidates in the paths to the dataset in OMERO. * - * @param client The client handling the connection. + * @param conn The connection handler. * @param threads The number of threads (same value used for filesets and uploads). * @param paths Paths to the image files on the computer. * @@ -450,17 +450,17 @@ public boolean importImages(ConnectionHandler client, String... paths) * @throws AccessException Cannot access data. * @throws IOException Cannot read file. */ - public boolean importImages(ConnectionHandler client, int threads, String... paths) + public boolean importImages(ConnectionHandler conn, int threads, String... paths) throws ServiceException, AccessException, IOException { - return importImages(client, data, threads, paths); + return importImages(conn, data, threads, paths); } /** * Imports one image file to the dataset in OMERO. * - * @param client The client handling the connection. - * @param path Path to the image file on the computer. + * @param conn The connection handler. + * @param path Path to the image file on the computer. * * @return The list of IDs of the newly imported images. * @@ -468,9 +468,9 @@ public boolean importImages(ConnectionHandler client, int threads, String... pat * @throws AccessException Cannot access data. * @throws IOException Cannot read file. */ - public List importImage(ConnectionHandler client, String path) + public List importImage(ConnectionHandler conn, String path) throws ServiceException, AccessException, IOException { - return importImage(client, data, path); + return importImage(conn, data, path); } diff --git a/src/main/java/fr/igred/omero/containers/FolderWrapper.java b/src/main/java/fr/igred/omero/containers/FolderWrapper.java index 85c0b102..94bb9164 100644 --- a/src/main/java/fr/igred/omero/containers/FolderWrapper.java +++ b/src/main/java/fr/igred/omero/containers/FolderWrapper.java @@ -89,18 +89,18 @@ public FolderWrapper(Folder folder) { /** * Constructor of the FolderWrapper class. Save the folder in OMERO * - * @param client The client handling the connection. - * @param name Name of the folder. + * @param conn The connection handler. + * @param name Name of the folder. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. */ - public FolderWrapper(ConnectionHandler client, String name) + public FolderWrapper(ConnectionHandler conn, String name) throws ServiceException, AccessException { super(new FolderData()); data.setName(name); - Folder f = (Folder) ExceptionHandler.of(client.getGateway(), - g -> g.getUpdateService(client.getCtx()) + Folder f = (Folder) ExceptionHandler.of(conn.getGateway(), + g -> g.getUpdateService(conn.getCtx()) .saveAndReturnObject(data.asIObject())) .handleServerAndService("Could not create Folder with name: " + name) .get(); @@ -122,7 +122,7 @@ protected String annotationLinkType() { /** * Adds an annotation to the object in OMERO, if possible. * - * @param client The client handling the connection. + * @param dm The data manager. * @param annotation Annotation to be added. * @param The type of the annotation. * @@ -131,12 +131,12 @@ protected String annotationLinkType() { * @throws ExecutionException A Facility can't be retrieved or instantiated. */ @Override - protected void link(DataManager client, A annotation) + protected void link(DataManager dm, A annotation) throws ServiceException, AccessException, ExecutionException { FolderAnnotationLink link = new FolderAnnotationLinkI(); link.setChild(annotation.asAnnotation()); link.setParent(data.asFolder()); - client.save(link); + dm.save(link); } @@ -241,14 +241,14 @@ public List getChildren() { /** * Links images to the folder in OMERO. * - * @param client The client handling the connection. + * @param dm The data manager. * @param images Images to add. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void addImages(DataManager client, ImageWrapper... images) + public void addImages(DataManager dm, ImageWrapper... images) throws ServiceException, AccessException, ExecutionException { List links = new ArrayList<>(images.length); List linkedIds = getImages().stream() @@ -262,8 +262,8 @@ public void addImages(DataManager client, ImageWrapper... images) links.add(link); } } - ExceptionHandler.of(client.getDMFacility(), - d -> d.saveAndReturnObject(client.getCtx(), links, null, null)) + ExceptionHandler.of(dm.getDMFacility(), + d -> d.saveAndReturnObject(dm.getCtx(), links, null, null)) .handleOMEROException("Cannot save links.") .rethrow(); } @@ -300,7 +300,7 @@ public List getImages(Browser browser) /** * Adds ROIs to the folder and associate them to the provided image ID. * - * @param client The client handling the connection. + * @param dm The data manager. * @param imageId The image ID. * @param rois ROIs to add. * @@ -308,14 +308,14 @@ public List getImages(Browser browser) * @throws AccessException Cannot access data. * @throws ExecutionException If the ROIFacility can't be retrieved or instantiated. */ - public void addROIs(DataManager client, long imageId, ROIWrapper... rois) + public void addROIs(DataManager dm, long imageId, ROIWrapper... rois) throws ServiceException, AccessException, ExecutionException { List roiData = Arrays.stream(rois) .map(ObjectWrapper::asDataObject) .collect(toList()); - ROIFacility roiFac = client.getRoiFacility(); + ROIFacility roiFac = dm.getRoiFacility(); ExceptionHandler.of(roiFac, - rf -> rf.addRoisToFolders(client.getCtx(), + rf -> rf.addRoisToFolders(dm.getCtx(), imageId, roiData, singletonList(data))) @@ -327,24 +327,24 @@ public void addROIs(DataManager client, long imageId, ROIWrapper... rois) /** * Adds ROIs to the folder and associate them to the provided image. * - * @param client The client handling the connection. - * @param image The image. - * @param rois ROIs to add. + * @param dm The data manager. + * @param image The image. + * @param rois ROIs to add. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException If the ROIFacility can't be retrieved or instantiated. */ - public void addROIs(DataManager client, ImageWrapper image, ROIWrapper... rois) + public void addROIs(DataManager dm, ImageWrapper image, ROIWrapper... rois) throws ServiceException, AccessException, ExecutionException { - addROIs(client, image.getId(), rois); + addROIs(dm, image.getId(), rois); } /** * Gets the ROIs contained in the folder associated with the provided image ID. * - * @param client The client handling the connection. + * @param dm The data manager. * @param imageId The image. * * @return See above. @@ -353,10 +353,10 @@ public void addROIs(DataManager client, ImageWrapper image, ROIWrapper... rois) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getROIs(DataManager client, long imageId) + public List getROIs(DataManager dm, long imageId) throws ServiceException, AccessException, ExecutionException { - Collection roiResults = call(client.getRoiFacility(), - rf -> rf.loadROIsForFolder(client.getCtx(), + Collection roiResults = call(dm.getRoiFacility(), + rf -> rf.loadROIsForFolder(dm.getCtx(), imageId, data.getId()), "Cannot get ROIs from " + this); @@ -375,8 +375,8 @@ public List getROIs(DataManager client, long imageId) /** * Gets the ROIs contained in the folder associated with the provided image. * - * @param client The client handling the connection. - * @param image The image. + * @param dm The data manager. + * @param image The image. * * @return See above. * @@ -384,9 +384,9 @@ public List getROIs(DataManager client, long imageId) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getROIs(DataManager client, ImageWrapper image) + public List getROIs(DataManager dm, ImageWrapper image) throws ServiceException, AccessException, ExecutionException { - return getROIs(client, image.getId()); + return getROIs(dm, image.getId()); } @@ -394,16 +394,16 @@ public List getROIs(DataManager client, ImageWrapper image) * Unlink all ROIs associated to the provided image ID from the folder. *

ROIs are now linked to the image directly. * - * @param client The client handling the connection. + * @param dm The data manager. * @param imageId The image ID. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void unlinkAllROIs(DataManager client, long imageId) + public void unlinkAllROIs(DataManager dm, long imageId) throws ServiceException, AccessException, ExecutionException { - unlinkROIs(client, getROIs(client, imageId)); + unlinkROIs(dm, getROIs(dm, imageId)); } @@ -411,16 +411,16 @@ public void unlinkAllROIs(DataManager client, long imageId) * Unlink all ROIs associated to the provided image from the folder. *

ROIs are now linked to the image directly. * - * @param client The client handling the connection. - * @param image The image. + * @param dm The data manager. + * @param image The image. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void unlinkAllROIs(DataManager client, ImageWrapper image) + public void unlinkAllROIs(DataManager dm, ImageWrapper image) throws ServiceException, AccessException, ExecutionException { - unlinkAllROIs(client, image.getId()); + unlinkAllROIs(dm, image.getId()); } @@ -429,16 +429,16 @@ public void unlinkAllROIs(DataManager client, ImageWrapper image) *

The folder must be loaded beforehand.

*

ROIs are now linked to their images directly.

* - * @param client The client handling the connection. + * @param dm The data manager. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void unlinkAllROIs(DataManager client) + public void unlinkAllROIs(DataManager dm) throws ServiceException, AccessException, ExecutionException { Collection rois = wrap(data.copyROILinks(), ROIWrapper::new); - unlinkROIs(client, rois.toArray(EMPTY_ROI_ARRAY)); + unlinkROIs(dm, rois.toArray(EMPTY_ROI_ARRAY)); } @@ -446,16 +446,16 @@ public void unlinkAllROIs(DataManager client) * Unlink ROIs from the folder. *

The ROIs are now linked to the image directly. * - * @param client The data manager. - * @param rois ROI to unlink. + * @param dm The data manager. + * @param rois ROI to unlink. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void unlinkROIs(DataManager client, ROIWrapper... rois) + public void unlinkROIs(DataManager dm, ROIWrapper... rois) throws ServiceException, AccessException, ExecutionException { - unlinkROIs(client, Arrays.asList(rois)); + unlinkROIs(dm, Arrays.asList(rois)); } @@ -463,20 +463,20 @@ public void unlinkROIs(DataManager client, ROIWrapper... rois) * Unlink ROIs from the folder. *

The ROIs are now linked to the image directly. * - * @param client The data manager. - * @param rois ROI to unlink. + * @param dm The data manager. + * @param rois ROI to unlink. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void unlinkROIs(DataManager client, Collection rois) + public void unlinkROIs(DataManager dm, Collection rois) throws ServiceException, AccessException, ExecutionException { List roiData = rois.stream() .map(ROIWrapper::asDataObject) .collect(toList()); - ExceptionHandler.ofConsumer(client.getRoiFacility(), - rf -> rf.removeRoisFromFolders(client.getCtx(), + ExceptionHandler.ofConsumer(dm.getRoiFacility(), + rf -> rf.removeRoisFromFolders(dm.getCtx(), -1L, roiData, singletonList(data))) diff --git a/src/main/java/fr/igred/omero/containers/ProjectWrapper.java b/src/main/java/fr/igred/omero/containers/ProjectWrapper.java index c262eb6e..0cd97b93 100644 --- a/src/main/java/fr/igred/omero/containers/ProjectWrapper.java +++ b/src/main/java/fr/igred/omero/containers/ProjectWrapper.java @@ -66,7 +66,7 @@ public ProjectWrapper(ProjectData project) { /** * Constructor of the ProjectWrapper class. Creates a new project and save it to OMERO. * - * @param client The client handling the connection. + * @param dm The data manager. * @param name Project name. * @param description Project description. * @@ -74,12 +74,12 @@ public ProjectWrapper(ProjectData project) { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public ProjectWrapper(DataManager client, String name, String description) + public ProjectWrapper(DataManager dm, String name, String description) throws ServiceException, AccessException, ExecutionException { super(new ProjectData()); data.setName(name); data.setDescription(description); - super.saveAndUpdate(client); + super.saveAndUpdate(dm); } @@ -166,7 +166,7 @@ public List getDatasets(String name) { * Creates a dataset and adds it to the project in OMERO. *

The project needs to be reloaded afterwards to list the new dataset.

* - * @param client The client handling the connection. + * @param dm The data manager. * @param name Dataset name. * @param description Dataset description. * @@ -176,18 +176,18 @@ public List getDatasets(String name) { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public DatasetWrapper addDataset(DataManager client, String name, String description) + public DatasetWrapper addDataset(DataManager dm, String name, String description) throws ServiceException, AccessException, ExecutionException { DatasetWrapper dataset = new DatasetWrapper(name, description); - dataset.saveAndUpdate(client); - return addDataset(client, dataset); + dataset.saveAndUpdate(dm); + return addDataset(dm, dataset); } /** * Adds a dataset to the project in OMERO. * - * @param client The client handling the connection. + * @param dm The data manager. * @param dataset Dataset to be added. * * @return The object saved in OMERO. @@ -196,14 +196,14 @@ public DatasetWrapper addDataset(DataManager client, String name, String descrip * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public DatasetWrapper addDataset(DataManager client, DatasetWrapper dataset) + public DatasetWrapper addDataset(DataManager dm, DatasetWrapper dataset) throws ServiceException, AccessException, ExecutionException { - dataset.saveAndUpdate(client); + dataset.saveAndUpdate(dm); ProjectDatasetLink link = new ProjectDatasetLinkI(); link.setChild(dataset.asDataObject().asDataset()); link.setParent(data.asProject()); - client.save(link); + dm.save(link); return dataset; } diff --git a/src/main/java/fr/igred/omero/core/ImageWrapper.java b/src/main/java/fr/igred/omero/core/ImageWrapper.java index 1cf5e7a1..90c817ac 100644 --- a/src/main/java/fr/igred/omero/core/ImageWrapper.java +++ b/src/main/java/fr/igred/omero/core/ImageWrapper.java @@ -508,8 +508,8 @@ public List getFilesetImages(Browser browser) * Links ROIs to the image in OMERO. *

DO NOT USE IT IF A SHAPE WAS DELETED !!! * - * @param client The client handling the connection. - * @param rois ROIs to be added. + * @param dm The data manager. + * @param rois ROIs to be added. * * @return The updated list of ROIs. * @@ -517,14 +517,14 @@ public List getFilesetImages(Browser browser) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List saveROIs(DataManager client, Collection rois) + public List saveROIs(DataManager dm, Collection rois) throws ServiceException, AccessException, ExecutionException { rois.forEach(r -> r.setImage(this)); List roisData = rois.stream() .map(ObjectWrapper::asDataObject) .collect(Collectors.toList()); - Collection results = call(client.getRoiFacility(), - rf -> rf.saveROIs(client.getCtx(), + Collection results = call(dm.getRoiFacility(), + rf -> rf.saveROIs(dm.getCtx(), data.getId(), roisData), "Cannot link ROI to " + this); @@ -536,8 +536,8 @@ public List saveROIs(DataManager client, Collection DO NOT USE IT IF A SHAPE WAS DELETED !!! * - * @param client The data manager. - * @param rois ROIs to be added. + * @param dm The data manager. + * @param rois ROIs to be added. * * @return The updated list of ROIs. * @@ -545,16 +545,16 @@ public List saveROIs(DataManager client, Collection saveROIs(DataManager client, ROIWrapper... rois) + public List saveROIs(DataManager dm, ROIWrapper... rois) throws ServiceException, AccessException, ExecutionException { - return saveROIs(client, Arrays.asList(rois)); + return saveROIs(dm, Arrays.asList(rois)); } /** * Gets all ROIs linked to the image in OMERO * - * @param client The client handling the connection. + * @param dm The data manager. * * @return List of ROIs linked to the image. * @@ -562,10 +562,10 @@ public List saveROIs(DataManager client, ROIWrapper... rois) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getROIs(DataManager client) + public List getROIs(DataManager dm) throws ServiceException, AccessException, ExecutionException { - List roiResults = call(client.getRoiFacility(), - rf -> rf.loadROIs(client.getCtx(), + List roiResults = call(dm.getRoiFacility(), + rf -> rf.loadROIs(dm.getCtx(), data.getId()), "Cannot get ROIs from " + this); @@ -583,7 +583,7 @@ public List getROIs(DataManager client) /** * Gets the list of folders linked to the ROIs in this image. * - * @param client The client handling the connection. + * @param dm The data manager. * * @return See above. * @@ -591,10 +591,10 @@ public List getROIs(DataManager client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getROIFolders(DataManager client) + public List getROIFolders(DataManager dm) throws ServiceException, AccessException, ExecutionException { - Collection folders = call(client.getRoiFacility(), - rf -> rf.getROIFolders(client.getCtx(), + Collection folders = call(dm.getRoiFacility(), + rf -> rf.getROIFolders(dm.getCtx(), data.getId()), "Cannot get folders for " + this); diff --git a/src/main/java/fr/igred/omero/core/PixelsWrapper.java b/src/main/java/fr/igred/omero/core/PixelsWrapper.java index a1aefaa3..fd4bc287 100644 --- a/src/main/java/fr/igred/omero/core/PixelsWrapper.java +++ b/src/main/java/fr/igred/omero/core/PixelsWrapper.java @@ -363,18 +363,18 @@ public int getSizeT() { /** * Creates a {@link omero.gateway.facility.RawDataFacility} to retrieve the pixel values. * - * @param client The client handling the connection. + * @param conn The connection handler. * * @return

  • True if a new RawDataFacility was created
  • *
  • False otherwise
* * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - boolean createRawDataFacility(ConnectionHandler client) throws ExecutionException { + boolean createRawDataFacility(ConnectionHandler conn) throws ExecutionException { boolean created = false; if (rawDataFacility == null) { - rawDataFacility = client.getGateway() - .getFacility(RawDataFacility.class); + rawDataFacility = conn.getGateway() + .getFacility(RawDataFacility.class); created = true; } return created; @@ -393,23 +393,23 @@ void destroyRawDataFacility() { /** * Returns an array containing the value for each voxel * - * @param client The client handling the connection. + * @param conn The connection handler. * * @return Array containing the value for each voxel of the image. * * @throws AccessException If an error occurs while retrieving the plane data from the pixels source. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public double[][][][][] getAllPixels(ConnectionHandler client) + public double[][][][][] getAllPixels(ConnectionHandler conn) throws AccessException, ExecutionException { - return getAllPixels(client, null, null, null, null, null); + return getAllPixels(conn, null, null, null, null, null); } /** * Returns an array containing the value for each voxel corresponding to the bounds * - * @param client The client handling the connection. + * @param conn The connection handler. * @param xBounds Array containing the X bounds from which the pixels should be retrieved. * @param yBounds Array containing the Y bounds from which the pixels should be retrieved. * @param cBounds Array containing the C bounds from which the pixels should be retrieved. @@ -421,14 +421,14 @@ public double[][][][][] getAllPixels(ConnectionHandler client) * @throws AccessException If an error occurs while retrieving the plane data from the pixels source. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public double[][][][][] getAllPixels(ConnectionHandler client, + public double[][][][][] getAllPixels(ConnectionHandler conn, int[] xBounds, int[] yBounds, int[] cBounds, int[] zBounds, int[] tBounds) throws AccessException, ExecutionException { - boolean rdf = createRawDataFacility(client); + boolean rdf = createRawDataFacility(conn); Bounds lim = getBounds(xBounds, yBounds, cBounds, zBounds, tBounds); Coordinates start = lim.getStart(); @@ -452,7 +452,7 @@ public double[][][][][] getAllPixels(ConnectionHandler client, for (int z = 0, posZ = startZ; z < sizeZ; z++, posZ++) { for (int c = 0, posC = startC; c < sizeC; c++, posC++) { Coordinates pos = new Coordinates(x0, y0, posC, posZ, posT); - tab[t][z][c] = getTile(client, pos, sx, sy); + tab[t][z][c] = getTile(conn, pos, sx, sy); } } } @@ -467,7 +467,7 @@ public double[][][][][] getAllPixels(ConnectionHandler client, /** * Gets the tile at the specified position, with the defined width and height. * - * @param client The client handling the connection. + * @param conn The connection handler. * @param start Start position of the tile. * @param width Width of the tile. * @param height Height of the tile. @@ -477,11 +477,11 @@ public double[][][][][] getAllPixels(ConnectionHandler client, * @throws AccessException If an error occurs while retrieving the plane data from the pixels source. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - double[][] getTile(ConnectionHandler client, Coordinates start, int width, int height) + double[][] getTile(ConnectionHandler conn, Coordinates start, int width, int height) throws AccessException, ExecutionException { - boolean rdf = createRawDataFacility(client); + boolean rdf = createRawDataFacility(conn); double[][] tile = ExceptionHandler.of(this, - t -> t.getTileUnchecked(client.getCtx(), start, width, height)) + t -> t.getTileUnchecked(conn.getCtx(), start, width, height)) .rethrow(DataSourceException.class, AccessException::new, "Cannot read tile") @@ -530,24 +530,24 @@ private double[][] getTileUnchecked(SecurityContext ctx, Coordinates start, int /** * Returns an array containing the raw values for each voxel for each planes * - * @param client The client handling the connection. - * @param bpp Bytes per pixels of the image. + * @param conn The connection handler. + * @param bpp Bytes per pixels of the image. * * @return a table of bytes containing the pixel values * * @throws AccessException If an error occurs while retrieving the plane data from the pixels source. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public byte[][][][] getRawPixels(ConnectionHandler client, int bpp) + public byte[][][][] getRawPixels(ConnectionHandler conn, int bpp) throws AccessException, ExecutionException { - return getRawPixels(client, null, null, null, null, null, bpp); + return getRawPixels(conn, null, null, null, null, null, bpp); } /** * Returns an array containing the raw values for each voxel for each plane corresponding to the bounds * - * @param client The client handling the connection. + * @param conn The connection handler. * @param xBounds Array containing the X bounds from which the pixels should be retrieved. * @param yBounds Array containing the Y bounds from which the pixels should be retrieved. * @param cBounds Array containing the C bounds from which the pixels should be retrieved. @@ -560,7 +560,7 @@ public byte[][][][] getRawPixels(ConnectionHandler client, int bpp) * @throws AccessException If an error occurs while retrieving the plane data from the pixels source. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public byte[][][][] getRawPixels(ConnectionHandler client, + public byte[][][][] getRawPixels(ConnectionHandler conn, int[] xBounds, int[] yBounds, int[] cBounds, @@ -568,7 +568,7 @@ public byte[][][][] getRawPixels(ConnectionHandler client, int[] tBounds, int bpp) throws ExecutionException, AccessException { - boolean rdf = createRawDataFacility(client); + boolean rdf = createRawDataFacility(conn); Bounds lim = getBounds(xBounds, yBounds, cBounds, zBounds, tBounds); Coordinates start = lim.getStart(); @@ -592,7 +592,7 @@ public byte[][][][] getRawPixels(ConnectionHandler client, for (int z = 0, posZ = startZ; z < sizeZ; z++, posZ++) { for (int c = 0, posC = startC; c < sizeC; c++, posC++) { Coordinates pos = new Coordinates(x0, y0, posC, posZ, posT); - bytes[t][z][c] = getRawTile(client, pos, sx, sy, bpp); + bytes[t][z][c] = getRawTile(conn, pos, sx, sy, bpp); } } } @@ -606,7 +606,7 @@ public byte[][][][] getRawPixels(ConnectionHandler client, /** * Gets the tile at the specified position, with the defined width and height. * - * @param client The client handling the connection. + * @param conn The connection handler. * @param start Start position of the tile. * @param width Width of the tile. * @param height Height of the tile. @@ -617,11 +617,11 @@ public byte[][][][] getRawPixels(ConnectionHandler client, * @throws AccessException If an error occurs while retrieving the plane data from the pixels source. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - byte[] getRawTile(ConnectionHandler client, Coordinates start, int width, int height, int bpp) + byte[] getRawTile(ConnectionHandler conn, Coordinates start, int width, int height, int bpp) throws AccessException, ExecutionException { - boolean rdf = createRawDataFacility(client); + boolean rdf = createRawDataFacility(conn); byte[] tile = ExceptionHandler.of(this, - t -> t.getRawTileUnchecked(client.getCtx(), start, width, height, bpp)) + t -> t.getRawTileUnchecked(conn.getCtx(), start, width, height, bpp)) .rethrow(DataSourceException.class, AccessException::new, "Cannot read raw tile") diff --git a/src/main/java/fr/igred/omero/meta/ExperimenterWrapper.java b/src/main/java/fr/igred/omero/meta/ExperimenterWrapper.java index 521023b1..be181ec5 100644 --- a/src/main/java/fr/igred/omero/meta/ExperimenterWrapper.java +++ b/src/main/java/fr/igred/omero/meta/ExperimenterWrapper.java @@ -20,7 +20,6 @@ import fr.igred.omero.ObjectWrapper; import fr.igred.omero.client.AdminManager; -import fr.igred.omero.client.Client; import fr.igred.omero.exception.AccessException; import fr.igred.omero.exception.ServiceException; import omero.gateway.model.ExperimenterData; @@ -226,7 +225,7 @@ public boolean isLeader(GroupWrapper group) { /** * Returns {@code true} if the user is a full admin. * - * @param client {@link Client} that handles the connection + * @param admin The admin manager. * * @return See above. * @@ -234,10 +233,10 @@ public boolean isLeader(GroupWrapper group) { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public boolean isAdmin(AdminManager client) + public boolean isAdmin(AdminManager admin) throws ServiceException, AccessException, ExecutionException { - return !call(client.getAdminFacility(), - a -> a.getAdminPrivileges(client.getCtx(), data), + return !call(admin.getAdminFacility(), + a -> a.getAdminPrivileges(admin.getCtx(), data), "Cannot retrieve admin privileges.").isEmpty(); } diff --git a/src/main/java/fr/igred/omero/roi/ROIWrapper.java b/src/main/java/fr/igred/omero/roi/ROIWrapper.java index 68879a08..b2bba3d1 100644 --- a/src/main/java/fr/igred/omero/roi/ROIWrapper.java +++ b/src/main/java/fr/igred/omero/roi/ROIWrapper.java @@ -446,15 +446,15 @@ public void deleteShape(int pos) { /** * Saves the ROI. * - * @param client The client handling the connection. + * @param dm The data manager. * - * @throws AccessException Cannot access data. - * @throws ServiceException Cannot connect to OMERO. + * @throws AccessException Cannot access data. + * @throws ServiceException Cannot connect to OMERO. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void saveROI(DataManager client) + public void saveROI(DataManager dm) throws AccessException, ServiceException, ExecutionException { - Roi roi = (Roi) client.save(data.asIObject()); + Roi roi = (Roi) dm.save(data.asIObject()); data = new ROIData(roi); } @@ -573,7 +573,7 @@ protected String annotationLinkType() { /** * Attach an {@link AnnotationData} to this object. * - * @param client The client handling the connection. + * @param dm The data manager. * @param annotation The {@link AnnotationData}. * @param
The type of the annotation. * @@ -582,12 +582,12 @@ protected String annotationLinkType() { * @throws ExecutionException A Facility can't be retrieved or instantiated. */ @Override - protected void link(DataManager client, A annotation) + protected void link(DataManager dm, A annotation) throws ServiceException, AccessException, ExecutionException { RoiAnnotationLink link = new RoiAnnotationLinkI(); link.setChild(annotation.asAnnotation()); link.setParent((Roi) data.asIObject()); - client.save(link); + dm.save(link); } } \ No newline at end of file diff --git a/src/main/java/fr/igred/omero/roi/ShapeWrapper.java b/src/main/java/fr/igred/omero/roi/ShapeWrapper.java index 0ba5911a..347f234b 100644 --- a/src/main/java/fr/igred/omero/roi/ShapeWrapper.java +++ b/src/main/java/fr/igred/omero/roi/ShapeWrapper.java @@ -608,7 +608,7 @@ protected String annotationLinkType() { /** * Attach an {@link AnnotationData} to this object. * - * @param client The client handling the connection. + * @param dm The data manager. * @param annotation The {@link AnnotationData}. * @param The type of the annotation. * @@ -617,12 +617,12 @@ protected String annotationLinkType() { * @throws ExecutionException A Facility can't be retrieved or instantiated. */ @Override - public void link(DataManager client, A annotation) + public void link(DataManager dm, A annotation) throws ServiceException, AccessException, ExecutionException { ShapeAnnotationLink link = new ShapeAnnotationLinkI(); link.setChild(annotation.asAnnotation()); link.setParent((omero.model.Shape) data.asIObject()); - client.save(link); + dm.save(link); } } diff --git a/src/main/java/fr/igred/omero/screen/PlateAcquisitionWrapper.java b/src/main/java/fr/igred/omero/screen/PlateAcquisitionWrapper.java index ec2aff4f..ffbbe000 100644 --- a/src/main/java/fr/igred/omero/screen/PlateAcquisitionWrapper.java +++ b/src/main/java/fr/igred/omero/screen/PlateAcquisitionWrapper.java @@ -131,7 +131,7 @@ public void setDescription(String description) { /** * Adds a tag to the object in OMERO, if possible. * - * @param client The client handling the connection. + * @param dm The data manager. * @param annotation Tag to be added. * @param The type of the annotation. * @@ -140,12 +140,12 @@ public void setDescription(String description) { * @throws ExecutionException A Facility can't be retrieved or instantiated. */ @Override - protected void link(DataManager client, A annotation) + protected void link(DataManager dm, A annotation) throws ServiceException, AccessException, ExecutionException { PlateAcquisitionAnnotationLink link = new PlateAcquisitionAnnotationLinkI(); link.setChild(annotation.asAnnotation()); link.setParent((omero.model.PlateAcquisition) data.asIObject()); - client.save(link); + dm.save(link); } diff --git a/src/main/java/fr/igred/omero/screen/ScreenWrapper.java b/src/main/java/fr/igred/omero/screen/ScreenWrapper.java index fdac53f1..0d87a42f 100644 --- a/src/main/java/fr/igred/omero/screen/ScreenWrapper.java +++ b/src/main/java/fr/igred/omero/screen/ScreenWrapper.java @@ -53,7 +53,7 @@ public class ScreenWrapper extends RepositoryObjectWrapper { /** * Constructor of the ScreenWrapper class. Creates a new screen and saves it to OMERO. * - * @param client The client handling the connection. + * @param dm The data manager. * @param name Screen name. * @param description Screen description. * @@ -61,12 +61,12 @@ public class ScreenWrapper extends RepositoryObjectWrapper { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public ScreenWrapper(DataManager client, String name, String description) + public ScreenWrapper(DataManager dm, String name, String description) throws ServiceException, AccessException, ExecutionException { super(new ScreenData()); data.setName(name); data.setDescription(description); - super.saveAndUpdate(client); + super.saveAndUpdate(dm); } @@ -333,8 +333,8 @@ public void reload(Browser browser) /** * Imports all images candidates in the paths to the screen in OMERO. * - * @param client The client handling the connection. - * @param paths Paths to the image files on the computer. + * @param conn The connection handler. + * @param paths Paths to the image files on the computer. * * @return If the import did not exit because of an error. * @@ -342,16 +342,16 @@ public void reload(Browser browser) * @throws AccessException Cannot access data. * @throws IOException Cannot read file. */ - public boolean importImages(ConnectionHandler client, String... paths) + public boolean importImages(ConnectionHandler conn, String... paths) throws ServiceException, AccessException, IOException { - return importImages(client, 1, paths); + return importImages(conn, 1, paths); } /** * Imports all images candidates in the paths to the screen in OMERO. * - * @param client The client handling the connection. + * @param conn The connection handler. * @param threads The number of threads (same value used for filesets and uploads). * @param paths Paths to the image files on the computer. * @@ -361,17 +361,17 @@ public boolean importImages(ConnectionHandler client, String... paths) * @throws AccessException Cannot access data. * @throws IOException Cannot read file. */ - public boolean importImages(ConnectionHandler client, int threads, String... paths) + public boolean importImages(ConnectionHandler conn, int threads, String... paths) throws ServiceException, AccessException, IOException { - return importImages(client, data, threads, paths); + return importImages(conn, data, threads, paths); } /** * Imports one image file to the screen in OMERO. * - * @param client The client handling the connection. - * @param path Path to the image file on the computer. + * @param conn The connection handler. + * @param path Path to the image file on the computer. * * @return The list of IDs of the newly imported images. * @@ -379,9 +379,9 @@ public boolean importImages(ConnectionHandler client, int threads, String... pat * @throws AccessException Cannot access data. * @throws IOException Cannot read file. */ - public List importImage(ConnectionHandler client, String path) + public List importImage(ConnectionHandler conn, String path) throws ServiceException, AccessException, IOException { - return importImage(client, data, path); + return importImage(conn, data, path); } } diff --git a/src/test/java/fr/igred/omero/annotations/ImageJTableTest.java b/src/test/java/fr/igred/omero/annotations/ImageJTableTest.java index bd87576b..bd638c19 100644 --- a/src/test/java/fr/igred/omero/annotations/ImageJTableTest.java +++ b/src/test/java/fr/igred/omero/annotations/ImageJTableTest.java @@ -61,7 +61,7 @@ class ImageJTableTest extends UserTest { protected ImageWrapper image = new ImageWrapper(new ImageData()); - private static List createAndSaveROI(DataManager client, ImageWrapper image, String name) + private static List createAndSaveROI(DataManager dm, ImageWrapper image, String name) throws AccessException, ServiceException, ExecutionException { ROIWrapper roi = new ROIWrapper(); roi.setImage(image); @@ -77,8 +77,8 @@ private static List createAndSaveROI(DataManager client, ImageWrappe if (name != null && !name.trim().isEmpty()) { roi.setName(name); } - image.saveROIs(client, roi); - return image.getROIs(client); + image.saveROIs(dm, roi); + return image.getROIs(dm); }