From 01bbd56792dcedd2ccc1c94e669c488781f40e3a Mon Sep 17 00:00:00 2001 From: Pierre Pouchin Date: Wed, 27 Nov 2024 12:17:20 +0100 Subject: [PATCH] Rename client variable to browser when appropriate --- .../fr/igred/omero/AnnotatableWrapper.java | 96 ++++++------- .../omero/annotations/AnnotationWrapper.java | 76 +++++----- .../omero/containers/DatasetWrapper.java | 108 +++++++------- .../igred/omero/containers/FolderWrapper.java | 6 +- .../omero/containers/ProjectWrapper.java | 66 ++++----- .../fr/igred/omero/core/ImageWrapper.java | 134 +++++++++--------- .../fr/igred/omero/core/PixelsWrapper.java | 8 +- .../omero/screen/PlateAcquisitionWrapper.java | 30 ++-- .../fr/igred/omero/screen/PlateWrapper.java | 48 +++---- .../fr/igred/omero/screen/ScreenWrapper.java | 20 +-- .../igred/omero/screen/WellSampleWrapper.java | 24 ++-- .../fr/igred/omero/screen/WellWrapper.java | 16 +-- 12 files changed, 316 insertions(+), 316 deletions(-) diff --git a/src/main/java/fr/igred/omero/AnnotatableWrapper.java b/src/main/java/fr/igred/omero/AnnotatableWrapper.java index edb8c5b7..d7c8a16f 100644 --- a/src/main/java/fr/igred/omero/AnnotatableWrapper.java +++ b/src/main/java/fr/igred/omero/AnnotatableWrapper.java @@ -87,7 +87,7 @@ protected AnnotatableWrapper(T o) { /** * Checks if a specific annotation is linked to the object. * - * @param client The client handling the connection. + * @param browser The data browser. * @param annotation Annotation to be checked. * @param The type of the annotation. * @@ -97,9 +97,9 @@ protected AnnotatableWrapper(T o) { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public > boolean isLinked(Browser client, A annotation) + public > boolean isLinked(Browser browser, A annotation) throws ServiceException, AccessException, ExecutionException { - return getAnnotations(client).stream().anyMatch(a -> a.getId() == annotation.getId()); + return getAnnotations(browser).stream().anyMatch(a -> a.getId() == annotation.getId()); } @@ -242,7 +242,7 @@ public void addTags(Client client, Long... ids) /** * Gets all tags linked to an object in OMERO, if possible. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -250,12 +250,12 @@ public void addTags(Client client, Long... ids) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getTags(Browser client) + public List getTags(Browser browser) throws ServiceException, AccessException, ExecutionException { List> types = singletonList(TagAnnotationData.class); - List annotations = call(client.getMetadata(), - m -> m.getAnnotations(client.getCtx(), + List annotations = call(browser.getMetadata(), + m -> m.getAnnotations(browser.getCtx(), data, types, null), @@ -273,7 +273,7 @@ public List getTags(Browser client) /** * Gets all map annotations linked to an object in OMERO, if possible. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -281,11 +281,11 @@ public List getTags(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getMapAnnotations(Browser client) + public List getMapAnnotations(Browser browser) throws ServiceException, AccessException, ExecutionException { List> types = singletonList(MapAnnotationData.class); - List annotations = call(client.getMetadata(), - m -> m.getAnnotations(client.getCtx(), + List annotations = call(browser.getMetadata(), + m -> m.getAnnotations(browser.getCtx(), data, types, null), @@ -322,7 +322,7 @@ public void addKeyValuePair(Client client, String key, String value) /** * Gets the List of Key-Value pairs associated to an object. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -330,20 +330,20 @@ public void addKeyValuePair(Client client, String key, String value) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List> getKeyValuePairs(Browser client) + public List> getKeyValuePairs(Browser browser) throws ServiceException, AccessException, ExecutionException { - return getMapAnnotations(client).stream() - .map(MapAnnotationWrapper::getContent) - .flatMap(List::stream) - .collect(toList()); + return getMapAnnotations(browser).stream() + .map(MapAnnotationWrapper::getContent) + .flatMap(List::stream) + .collect(toList()); } /** * Gets the value from a Key-Value pair associated to the object. * - * @param client The client handling the connection. - * @param key Key researched. + * @param browser The data browser. + * @param key Key researched. * * @return Value associated to the key. * @@ -352,21 +352,21 @@ public List> getKeyValuePairs(Browser client) * @throws NoSuchElementException Key not found. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getValues(Browser client, String key) + public List getValues(Browser browser, String key) throws ServiceException, AccessException, ExecutionException { - return getMapAnnotations(client).stream() - .map(MapAnnotationWrapper::getContentAsMap) - .map(kv -> kv.get(key)) - .filter(Objects::nonNull) - .flatMap(List::stream) - .collect(toList()); + return getMapAnnotations(browser).stream() + .map(MapAnnotationWrapper::getContentAsMap) + .map(kv -> kv.get(key)) + .filter(Objects::nonNull) + .flatMap(List::stream) + .collect(toList()); } /** * Returns all the ratings from the specified user IDs for this object. * - * @param client The client handling the connection. + * @param browser The data browser. * @param userIds List of user IDs (can be null, i. e. all users). * * @return See above. @@ -375,14 +375,14 @@ public List getValues(Browser client, String key) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - private List getRatings(Browser client, List userIds) + private List getRatings(Browser browser, List userIds) throws ServiceException, AccessException, ExecutionException { String error = "Cannot retrieve rating annotations from " + this; List> types = singletonList(RatingAnnotationData.class); - List annotations = call(client.getMetadata(), - m -> m.getAnnotations(client.getCtx(), + List annotations = call(browser.getMetadata(), + m -> m.getAnnotations(browser.getCtx(), data, types, userIds), @@ -400,7 +400,7 @@ private List getRatings(Browser client, List user /** * Returns all the ratings from all users for this object. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -408,9 +408,9 @@ private List getRatings(Browser client, List user * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getRatings(Browser client) + public List getRatings(Browser browser) throws ServiceException, AccessException, ExecutionException { - return getRatings(client, null); + return getRatings(browser, null); } @@ -449,7 +449,7 @@ public void rate(Client client, int rating) /** * Returns the user rating for this object (averaged if multiple ratings are linked). * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -457,11 +457,11 @@ public void rate(Client client, int rating) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public int getMyRating(Browser client) + public int getMyRating(Browser browser) throws ServiceException, AccessException, ExecutionException { - List userIds = singletonList(client.getCtx().getExperimenter()); + List userIds = singletonList(browser.getCtx().getExperimenter()); - List ratings = getRatings(client, userIds); + List ratings = getRatings(browser, userIds); int score = 0; for (RatingAnnotationWrapper rate : ratings) { score += rate.getRating(); @@ -707,7 +707,7 @@ public long addAndReplaceFile(Client client, File file) /** * Returns the file annotations * - * @param client The client handling the connection. + * @param browser The data browser. * * @return The list of tile annotations. * @@ -715,14 +715,14 @@ public long addAndReplaceFile(Client client, File file) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getFileAnnotations(Browser client) + public List getFileAnnotations(Browser browser) throws ExecutionException, ServiceException, AccessException { String error = "Cannot retrieve file annotations from " + this; List> types = singletonList(FileAnnotationData.class); - List annotations = call(client.getMetadata(), - m -> m.getAnnotations(client.getCtx(), + List annotations = call(browser.getMetadata(), + m -> m.getAnnotations(browser.getCtx(), data, types, null), @@ -825,7 +825,7 @@ protected void removeLink(Client client, String linkType, long childId) /** * Retrieves annotations linked to the object. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return A list of annotations, as AnnotationData. * @@ -833,10 +833,10 @@ protected void removeLink(Client client, String linkType, long childId) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - private List getAnnotationData(Browser client) + private List getAnnotationData(Browser browser) throws AccessException, ServiceException, ExecutionException { - return call(client.getMetadata(), - m -> m.getAnnotations(client.getCtx(), data), + return call(browser.getMetadata(), + m -> m.getAnnotations(browser.getCtx(), data), "Cannot get annotations from " + this); } @@ -844,7 +844,7 @@ private List getAnnotationData(Browser client) /** * Retrieves annotations linked to the object (of known types). * - * @param client The client handling the connection. + * @param browser The data browser. * * @return A list of annotations. * @@ -852,9 +852,9 @@ private List getAnnotationData(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public AnnotationList getAnnotations(Browser client) + public AnnotationList getAnnotations(Browser browser) throws AccessException, ServiceException, ExecutionException { - List annotationData = getAnnotationData(client); + List annotationData = getAnnotationData(browser); AnnotationList annotations = new AnnotationList(annotationData.size()); annotationData.forEach(annotations::add); diff --git a/src/main/java/fr/igred/omero/annotations/AnnotationWrapper.java b/src/main/java/fr/igred/omero/annotations/AnnotationWrapper.java index 3295bfbf..bb401269 100644 --- a/src/main/java/fr/igred/omero/annotations/AnnotationWrapper.java +++ b/src/main/java/fr/igred/omero/annotations/AnnotationWrapper.java @@ -113,25 +113,25 @@ public void setDescription(String description) { /** * Returns the number of annotations links for this object. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. */ - public int countAnnotationLinks(Browser client) + public int countAnnotationLinks(Browser browser) throws ServiceException, AccessException { String q = "select link.parent from ome.model.IAnnotationLink link" + " where link.child.id=" + getId(); - return client.findByQuery(q).size(); + return browser.findByQuery(q).size(); } /** * Gets all projects with this annotation from OMERO. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -139,22 +139,22 @@ public int countAnnotationLinks(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getProjects(Browser client) + public List getProjects(Browser browser) throws ServiceException, AccessException, ExecutionException { - List os = getLinks(client, ProjectWrapper.ANNOTATION_LINK); + List os = getLinks(browser, ProjectWrapper.ANNOTATION_LINK); Long[] ids = os.stream() .map(IObject::getId) .map(RLong::getValue) .sorted() .toArray(Long[]::new); - return client.getProjects(ids); + return browser.getProjects(ids); } /** * Gets all datasets with this annotation from OMERO. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -162,22 +162,22 @@ public List getProjects(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getDatasets(Browser client) + public List getDatasets(Browser browser) throws ServiceException, AccessException, ExecutionException { - List os = getLinks(client, DatasetWrapper.ANNOTATION_LINK); + List os = getLinks(browser, DatasetWrapper.ANNOTATION_LINK); Long[] ids = os.stream() .map(IObject::getId) .map(RLong::getValue) .sorted() .toArray(Long[]::new); - return client.getDatasets(ids); + return browser.getDatasets(ids); } /** * Gets all images with this annotation from OMERO. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -185,22 +185,22 @@ public List getDatasets(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImages(Browser client) + public List getImages(Browser browser) throws ServiceException, AccessException, ExecutionException { - List os = getLinks(client, ImageWrapper.ANNOTATION_LINK); + List os = getLinks(browser, ImageWrapper.ANNOTATION_LINK); Long[] ids = os.stream() .map(IObject::getId) .map(RLong::getValue) .sorted() .toArray(Long[]::new); - return client.getImages(ids); + return browser.getImages(ids); } /** * Gets all screens with this annotation from OMERO. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -208,22 +208,22 @@ public List getImages(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getScreens(Browser client) + public List getScreens(Browser browser) throws ServiceException, AccessException, ExecutionException { - List os = getLinks(client, ScreenWrapper.ANNOTATION_LINK); + List os = getLinks(browser, ScreenWrapper.ANNOTATION_LINK); Long[] ids = os.stream() .map(IObject::getId) .map(RLong::getValue) .sorted() .toArray(Long[]::new); - return client.getScreens(ids); + return browser.getScreens(ids); } /** * Gets all plates with this annotation from OMERO. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -231,31 +231,31 @@ public List getScreens(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getPlates(Browser client) + public List getPlates(Browser browser) throws ServiceException, AccessException, ExecutionException { - List os = getLinks(client, PlateWrapper.ANNOTATION_LINK); + List os = getLinks(browser, PlateWrapper.ANNOTATION_LINK); Long[] ids = os.stream() .map(IObject::getId) .map(RLong::getValue) .sorted() .toArray(Long[]::new); - return client.getPlates(ids); + return browser.getPlates(ids); } /** * Gets all plate acquisitions with this annotation from OMERO. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. */ - public List getPlateAcquisitions(Browser client) + public List getPlateAcquisitions(Browser browser) throws ServiceException, AccessException { - List os = getLinks(client, + List os = getLinks(browser, PlateAcquisitionWrapper.ANNOTATION_LINK); return os.stream() .map(omero.model.PlateAcquisition.class::cast) @@ -268,7 +268,7 @@ public List getPlateAcquisitions(Browser client) /** * Gets all wells with this annotation from OMERO. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -276,22 +276,22 @@ public List getPlateAcquisitions(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getWells(Browser client) + public List getWells(Browser browser) throws ServiceException, AccessException, ExecutionException { - List os = getLinks(client, WellWrapper.ANNOTATION_LINK); + List os = getLinks(browser, WellWrapper.ANNOTATION_LINK); Long[] ids = os.stream() .map(IObject::getId) .map(RLong::getValue) .sorted() .toArray(Long[]::new); - return client.getWells(ids); + return browser.getWells(ids); } /** * Gets all folders with this annotation from OMERO. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -299,22 +299,22 @@ public List getWells(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getFolders(Browser client) + public List getFolders(Browser browser) throws ServiceException, AccessException, ExecutionException { - List os = getLinks(client, FolderWrapper.ANNOTATION_LINK); + List os = getLinks(browser, FolderWrapper.ANNOTATION_LINK); Long[] ids = os.stream() .map(IObject::getId) .map(RLong::getValue) .sorted() .toArray(Long[]::new); - return client.loadFolders(ids); + return browser.loadFolders(ids); } /** * Retrieves all links of the given type. * - * @param client The client handling the connection. + * @param browser The data browser. * @param linkType The link type. * * @return The list of linked objects. @@ -322,10 +322,10 @@ public List getFolders(Browser client) * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. */ - private List getLinks(Browser client, String linkType) + private List getLinks(Browser browser, String linkType) throws ServiceException, AccessException { - return client.findByQuery("select link.parent from " + linkType + - " link where link.child = " + getId()); + return browser.findByQuery("select link.parent from " + linkType + + " link where link.child = " + getId()); } } diff --git a/src/main/java/fr/igred/omero/containers/DatasetWrapper.java b/src/main/java/fr/igred/omero/containers/DatasetWrapper.java index 77608813..c204beb1 100644 --- a/src/main/java/fr/igred/omero/containers/DatasetWrapper.java +++ b/src/main/java/fr/igred/omero/containers/DatasetWrapper.java @@ -144,7 +144,7 @@ protected String annotationLinkType() { /** * Retrieves the projects containing this dataset. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -152,16 +152,16 @@ protected String annotationLinkType() { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getProjects(Browser client) + public List getProjects(Browser browser) throws ServiceException, AccessException, ExecutionException { String query = "select link.parent from ProjectDatasetLink as link" + " where link.child=" + getId(); - List os = client.findByQuery(query); - return client.getProjects(os.stream() - .map(IObject::getId) - .map(RLong::getValue) - .distinct() - .toArray(Long[]::new)); + List os = browser.findByQuery(query); + return browser.getProjects(os.stream() + .map(IObject::getId) + .map(RLong::getValue) + .distinct() + .toArray(Long[]::new)); } @@ -178,7 +178,7 @@ public List getImages() { /** * Gets all images in the dataset available from OMERO. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -186,10 +186,10 @@ public List getImages() { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImages(Browser client) + public List getImages(Browser browser) throws ServiceException, AccessException, ExecutionException { - Collection images = call(client.getBrowseFacility(), - bf -> bf.getImagesForDatasets(client.getCtx(), + Collection images = call(browser.getBrowseFacility(), + bf -> bf.getImagesForDatasets(browser.getCtx(), singletonList(data.getId())), "Cannot get images from " + this); return wrap(images, ImageWrapper::new); @@ -199,8 +199,8 @@ public List getImages(Browser client) /** * Gets all images in the dataset with a certain name from OMERO. * - * @param client The client handling the connection. - * @param name Name searched. + * @param browser The data browser. + * @param name Name searched. * * @return See above. * @@ -208,9 +208,9 @@ public List getImages(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImages(Browser client, String name) + public List getImages(Browser browser, String name) throws ServiceException, AccessException, ExecutionException { - List images = getImages(client); + List images = getImages(browser); images.removeIf(image -> !image.getName().equals(name)); return images; } @@ -219,8 +219,8 @@ public List getImages(Browser client, String name) /** * Gets all images in the dataset with a certain motif in their name from OMERO. * - * @param client The client handling the connection. - * @param motif Motif searched in an image name. + * @param browser The data browser. + * @param motif Motif searched in an image name. * * @return See above. * @@ -228,9 +228,9 @@ public List getImages(Browser client, String name) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImagesLike(Browser client, String motif) + public List getImagesLike(Browser browser, String motif) throws ServiceException, AccessException, ExecutionException { - List images = getImages(client); + List images = getImages(browser); String regexp = ".*" + motif + ".*"; images.removeIf(image -> !image.getName().matches(regexp)); @@ -241,8 +241,8 @@ public List getImagesLike(Browser client, String motif) /** * Gets all images in the dataset tagged with a specified tag from OMERO. * - * @param client The client handling the connection. - * @param tag The tag annotation. + * @param browser The data browser. + * @param tag The tag annotation. * * @return See above. * @@ -250,17 +250,17 @@ public List getImagesLike(Browser client, String motif) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImagesTagged(Browser client, TagAnnotationWrapper tag) + public List getImagesTagged(Browser browser, TagAnnotationWrapper tag) throws ServiceException, AccessException, ExecutionException { - return getImagesTagged(client, tag.getId()); + return getImagesTagged(browser, tag.getId()); } /** * Gets all images in the dataset tagged with a specified tag from OMERO. * - * @param client The client handling the connection. - * @param tagId ID of the tag researched. + * @param browser The data browser. + * @param tagId ID of the tag researched. * * @return See above. * @@ -268,30 +268,30 @@ public List getImagesTagged(Browser client, TagAnnotationWrapper t * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImagesTagged(Browser client, Long tagId) + public List getImagesTagged(Browser browser, Long tagId) throws ServiceException, AccessException, ExecutionException { - Long[] ids = client.findByQuery("select link.parent" + - " from ImageAnnotationLink link" + - " where link.child = " + - tagId + - " and link.parent in" + - " (select link2.child" + - " from DatasetImageLink link2" + - " where link2.parent = " + - data.getId() + ")") - .stream() - .map(IObject::getId) - .map(RLong::getValue) - .toArray(Long[]::new); - return client.getImages(ids); + Long[] ids = browser.findByQuery("select link.parent" + + " from ImageAnnotationLink link" + + " where link.child = " + + tagId + + " and link.parent in" + + " (select link2.child" + + " from DatasetImageLink link2" + + " where link2.parent = " + + data.getId() + ")") + .stream() + .map(IObject::getId) + .map(RLong::getValue) + .toArray(Long[]::new); + return browser.getImages(ids); } /** * Gets all images in the dataset with a certain key * - * @param client The client handling the connection. - * @param key Name of the key researched. + * @param browser The data browser. + * @param key Name of the key researched. * * @return See above. * @@ -299,11 +299,11 @@ public List getImagesTagged(Browser client, Long tagId) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImagesWithKey(Browser client, String key) + public List getImagesWithKey(Browser browser, String key) throws ServiceException, AccessException, ExecutionException { String error = "Cannot get images with key \"" + key + "\" from " + this; - Collection images = call(client.getBrowseFacility(), - bf -> bf.getImagesForDatasets(client.getCtx(), + Collection images = call(browser.getBrowseFacility(), + bf -> bf.getImagesForDatasets(browser.getCtx(), singletonList(data.getId())), error); @@ -311,7 +311,7 @@ public List getImagesWithKey(Browser client, String key) for (ImageData image : images) { ImageWrapper imageWrapper = new ImageWrapper(image); - Map> pairs = imageWrapper.getKeyValuePairs(client) + Map> pairs = imageWrapper.getKeyValuePairs(browser) .stream() .collect(groupingBy(Map.Entry::getKey, mapping(Map.Entry::getValue, toList()))); @@ -328,9 +328,9 @@ public List getImagesWithKey(Browser client, String key) /** * Gets all images in the dataset with a certain key value pair from OMERO * - * @param client The client handling the connection. - * @param key Name of the key researched. - * @param value Value associated with the key. + * @param browser The data browser. + * @param key Name of the key researched. + * @param value Value associated with the key. * * @return See above. * @@ -338,10 +338,10 @@ public List getImagesWithKey(Browser client, String key) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImagesWithKeyValuePair(Browser client, String key, String value) + public List getImagesWithKeyValuePair(Browser browser, String key, String value) throws ServiceException, AccessException, ExecutionException { - Collection images = call(client.getBrowseFacility(), - bf -> bf.getImagesForDatasets(client.getCtx(), + Collection images = call(browser.getBrowseFacility(), + bf -> bf.getImagesForDatasets(browser.getCtx(), singletonList(data.getId())), "Cannot get images with key-value pair from " + this); @@ -349,7 +349,7 @@ public List getImagesWithKeyValuePair(Browser client, String key, for (ImageData image : images) { ImageWrapper imageWrapper = new ImageWrapper(image); - Map> pairs = imageWrapper.getKeyValuePairs(client) + Map> pairs = imageWrapper.getKeyValuePairs(browser) .stream() .collect(groupingBy(Map.Entry::getKey, mapping(Map.Entry::getValue, toList()))); diff --git a/src/main/java/fr/igred/omero/containers/FolderWrapper.java b/src/main/java/fr/igred/omero/containers/FolderWrapper.java index 034dc729..3c60bdc4 100644 --- a/src/main/java/fr/igred/omero/containers/FolderWrapper.java +++ b/src/main/java/fr/igred/omero/containers/FolderWrapper.java @@ -281,7 +281,7 @@ public List getImages() { /** * Retrieves the images contained in this folder. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above * @@ -289,9 +289,9 @@ public List getImages() { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImages(Browser client) + public List getImages(Browser browser) throws AccessException, ServiceException, ExecutionException { - reload(client); + reload(browser); return getImages(); } diff --git a/src/main/java/fr/igred/omero/containers/ProjectWrapper.java b/src/main/java/fr/igred/omero/containers/ProjectWrapper.java index 743c4d0a..b24fd77f 100644 --- a/src/main/java/fr/igred/omero/containers/ProjectWrapper.java +++ b/src/main/java/fr/igred/omero/containers/ProjectWrapper.java @@ -228,7 +228,7 @@ public void removeDataset(Client client, DatasetWrapper dataset) /** * Gets all images in the project available from OMERO. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -236,11 +236,11 @@ public void removeDataset(Client client, DatasetWrapper dataset) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImages(Browser client) + public List getImages(Browser browser) throws ServiceException, AccessException, ExecutionException { List projectIds = singletonList(getId()); - Collection images = call(client.getBrowseFacility(), - bf -> bf.getImagesForProjects(client.getCtx(), + Collection images = call(browser.getBrowseFacility(), + bf -> bf.getImagesForProjects(browser.getCtx(), projectIds), "Cannot get images from " + this); return distinct(wrap(images, ImageWrapper::new)); @@ -250,8 +250,8 @@ public List getImages(Browser client) /** * Gets all images in the project with a certain name from OMERO. * - * @param client The client handling the connection. - * @param name Name searched. + * @param browser The data browser. + * @param name Name searched. * * @return See above. * @@ -259,13 +259,13 @@ public List getImages(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImages(Browser client, String name) + public List getImages(Browser browser, String name) throws ServiceException, AccessException, ExecutionException { Collection datasets = getDatasets(); Collection> lists = new ArrayList<>(datasets.size()); for (DatasetWrapper dataset : datasets) { - lists.add(dataset.getImages(client, name)); + lists.add(dataset.getImages(browser, name)); } return flatten(lists); } @@ -274,7 +274,7 @@ public List getImages(Browser client, String name) /** * Gets all images with a certain name from datasets with the specified name inside this project on OMERO. * - * @param client The client handling the connection. + * @param browser The data browser. * @param datasetName Expected dataset name. * @param imageName Expected image name. * @@ -284,13 +284,13 @@ public List getImages(Browser client, String name) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImages(Browser client, String datasetName, String imageName) + public List getImages(Browser browser, String datasetName, String imageName) throws ServiceException, AccessException, ExecutionException { Collection datasets = getDatasets(datasetName); Collection> lists = new ArrayList<>(datasets.size()); for (DatasetWrapper dataset : datasets) { - lists.add(dataset.getImages(client, imageName)); + lists.add(dataset.getImages(browser, imageName)); } List images = lists.stream() .flatMap(Collection::stream) @@ -304,8 +304,8 @@ public List getImages(Browser client, String datasetName, String i /** * Gets all images in the project with a certain motif in their name from OMERO. * - * @param client The client handling the connection. - * @param motif Motif searched in an image name. + * @param browser The data browser. + * @param motif Motif searched in an image name. * * @return See above. * @@ -313,13 +313,13 @@ public List getImages(Browser client, String datasetName, String i * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImagesLike(Browser client, String motif) + public List getImagesLike(Browser browser, String motif) throws ServiceException, AccessException, ExecutionException { Collection datasets = getDatasets(); Collection> lists = new ArrayList<>(datasets.size()); for (DatasetWrapper dataset : datasets) { - lists.add(dataset.getImagesLike(client, motif)); + lists.add(dataset.getImagesLike(browser, motif)); } return flatten(lists); } @@ -328,8 +328,8 @@ public List getImagesLike(Browser client, String motif) /** * Gets all images in the project tagged with a specified tag from OMERO. * - * @param client The client handling the connection. - * @param tag TagAnnotationWrapper containing the tag researched. + * @param browser The data browser. + * @param tag TagAnnotationWrapper containing the tag researched. * * @return See above. * @@ -337,13 +337,13 @@ public List getImagesLike(Browser client, String motif) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImagesTagged(Browser client, TagAnnotationWrapper tag) + public List getImagesTagged(Browser browser, TagAnnotationWrapper tag) throws ServiceException, AccessException, ExecutionException { Collection datasets = getDatasets(); Collection> lists = new ArrayList<>(datasets.size()); for (DatasetWrapper dataset : datasets) { - lists.add(dataset.getImagesTagged(client, tag)); + lists.add(dataset.getImagesTagged(browser, tag)); } return flatten(lists); } @@ -352,8 +352,8 @@ public List getImagesTagged(Browser client, TagAnnotationWrapper t /** * Gets all images in the project tagged with a specified tag from OMERO. * - * @param client The client handling the connection. - * @param tagId Id of the tag researched. + * @param browser The data browser. + * @param tagId Id of the tag researched. * * @return See above. * @@ -361,13 +361,13 @@ public List getImagesTagged(Browser client, TagAnnotationWrapper t * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImagesTagged(Browser client, Long tagId) + public List getImagesTagged(Browser browser, Long tagId) throws ServiceException, AccessException, ExecutionException { Collection datasets = getDatasets(); Collection> lists = new ArrayList<>(datasets.size()); for (DatasetWrapper dataset : datasets) { - lists.add(dataset.getImagesTagged(client, tagId)); + lists.add(dataset.getImagesTagged(browser, tagId)); } return flatten(lists); } @@ -376,8 +376,8 @@ public List getImagesTagged(Browser client, Long tagId) /** * Gets all images in the project with a certain key * - * @param client The client handling the connection. - * @param key Name of the key researched. + * @param browser The data browser. + * @param key Name of the key researched. * * @return See above. * @@ -385,13 +385,13 @@ public List getImagesTagged(Browser client, Long tagId) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImagesWithKey(Browser client, String key) + public List getImagesWithKey(Browser browser, String key) throws ServiceException, AccessException, ExecutionException { Collection datasets = getDatasets(); Collection> lists = new ArrayList<>(datasets.size()); for (DatasetWrapper dataset : datasets) { - lists.add(dataset.getImagesWithKey(client, key)); + lists.add(dataset.getImagesWithKey(browser, key)); } return flatten(lists); } @@ -400,9 +400,9 @@ public List getImagesWithKey(Browser client, String key) /** * Gets all images in the project with a certain key value pair from OMERO. * - * @param client The client handling the connection. - * @param key Name of the key researched. - * @param value Value associated with the key. + * @param browser The data browser. + * @param key Name of the key researched. + * @param value Value associated with the key. * * @return See above. * @@ -410,13 +410,13 @@ public List getImagesWithKey(Browser client, String key) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImagesWithKeyValuePair(Browser client, String key, String value) + public List getImagesWithKeyValuePair(Browser browser, String key, String value) throws ServiceException, AccessException, ExecutionException { Collection datasets = getDatasets(); Collection> lists = new ArrayList<>(datasets.size()); for (DatasetWrapper dataset : datasets) { - lists.add(dataset.getImagesWithKeyValuePair(client, key, value)); + lists.add(dataset.getImagesWithKeyValuePair(browser, key, value)); } return flatten(lists); } @@ -425,7 +425,7 @@ public List getImagesWithKeyValuePair(Browser client, String key, /** * Reloads the project from OMERO. * - * @param browser The client handling the connection. + * @param browser The data browser. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. diff --git a/src/main/java/fr/igred/omero/core/ImageWrapper.java b/src/main/java/fr/igred/omero/core/ImageWrapper.java index 100753f0..16bef0df 100644 --- a/src/main/java/fr/igred/omero/core/ImageWrapper.java +++ b/src/main/java/fr/igred/omero/core/ImageWrapper.java @@ -281,7 +281,7 @@ protected String annotationLinkType() { /** * Retrieves the projects containing this image * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -289,12 +289,12 @@ protected String annotationLinkType() { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getProjects(Browser client) + public List getProjects(Browser browser) throws ServiceException, AccessException, ExecutionException { - List datasets = getDatasets(client); + List datasets = getDatasets(browser); Collection projects = new ArrayList<>(datasets.size()); for (DatasetWrapper dataset : datasets) { - projects.addAll(dataset.getProjects(client)); + projects.addAll(dataset.getProjects(browser)); } return distinct(projects); } @@ -303,7 +303,7 @@ public List getProjects(Browser client) /** * Retrieves the datasets containing this image * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -311,17 +311,17 @@ public List getProjects(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getDatasets(Browser client) + public List getDatasets(Browser browser) throws ServiceException, AccessException, ExecutionException { String query = "select link.parent from DatasetImageLink as link" + " where link.child=" + getId(); - List os = client.findByQuery(query); + List os = browser.findByQuery(query); - return client.getDatasets(os.stream() - .map(IObject::getId) - .map(RLong::getValue) - .distinct() - .toArray(Long[]::new)); + return browser.getDatasets(os.stream() + .map(IObject::getId) + .map(RLong::getValue) + .distinct() + .toArray(Long[]::new)); } @@ -343,7 +343,7 @@ public List getWellSamples() { /** * Retrieves the well samples containing this image and updates them from OMERO. * - * @param client The data browser. + * @param browser The data browser. * * @return See above * @@ -351,12 +351,12 @@ public List getWellSamples() { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getWellSamples(Browser client) + public List getWellSamples(Browser browser) throws AccessException, ServiceException, ExecutionException { - reload(client); + reload(browser); List samples = getWellSamples(); for (WellSampleWrapper sample : samples) { - sample.reload(client); + sample.reload(browser); } return samples; } @@ -365,7 +365,7 @@ public List getWellSamples(Browser client) /** * Retrieves the wells containing this image. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above * @@ -373,13 +373,13 @@ public List getWellSamples(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getWells(Browser client) + public List getWells(Browser browser) throws AccessException, ServiceException, ExecutionException { - List wellSamples = getWellSamples(client); + List wellSamples = getWellSamples(browser); Collection wells = new ArrayList<>(wellSamples.size()); for (WellSampleWrapper ws : wellSamples) { - wells.add(ws.getWell(client)); + wells.add(ws.getWell(browser)); } return distinct(wells); } @@ -388,7 +388,7 @@ public List getWells(Browser client) /** * Returns the plate acquisitions linked to this image. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -396,9 +396,9 @@ public List getWells(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getPlateAcquisitions(Browser client) + public List getPlateAcquisitions(Browser browser) throws AccessException, ServiceException, ExecutionException { - List wellSamples = getWellSamples(client); + List wellSamples = getWellSamples(browser); Collection acqs = new ArrayList<>(wellSamples.size()); for (WellSampleWrapper ws : wellSamples) { @@ -411,7 +411,7 @@ public List getPlateAcquisitions(Browser client) /** * Retrieves the plates containing this image. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above * @@ -419,18 +419,18 @@ public List getPlateAcquisitions(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getPlates(Browser client) + public List getPlates(Browser browser) throws AccessException, ServiceException, ExecutionException { - return distinct(getWells(client).stream() - .map(WellWrapper::getPlate) - .collect(Collectors.toList())); + return distinct(getWells(browser).stream() + .map(WellWrapper::getPlate) + .collect(Collectors.toList())); } /** * Retrieves the screens containing this image * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above * @@ -438,13 +438,13 @@ public List getPlates(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getScreens(Browser client) + public List getScreens(Browser browser) throws AccessException, ServiceException, ExecutionException { - List plates = getPlates(client); + List plates = getPlates(browser); Collection> screens = new ArrayList<>(plates.size()); for (PlateWrapper plate : plates) { - screens.add(plate.getScreens(client)); + screens.add(plate.getScreens(browser)); } return flatten(screens); } @@ -453,21 +453,21 @@ public List getScreens(Browser client) /** * Checks if image is orphaned (not in a WellSample nor linked to a dataset). * - * @param client The client handling the connection. + * @param browser The data browser. * * @return {@code true} if the image is orphaned, {@code false} otherwise. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. */ - public boolean isOrphaned(Browser client) + public boolean isOrphaned(Browser browser) throws ServiceException, AccessException { String dsQuery = "select link.parent from DatasetImageLink link" + " where link.child=" + getId(); String wsQuery = "select ws from WellSample ws where image=" + getId(); - boolean noDataset = client.findByQuery(dsQuery).isEmpty(); - boolean noWellSample = client.findByQuery(wsQuery).isEmpty(); + boolean noDataset = browser.findByQuery(dsQuery).isEmpty(); + boolean noWellSample = browser.findByQuery(wsQuery).isEmpty(); return noDataset && noWellSample; } @@ -475,7 +475,7 @@ public boolean isOrphaned(Browser client) /** * Returns the list of images sharing the same fileset as the current image. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -483,21 +483,21 @@ public boolean isOrphaned(Browser client) * @throws ServiceException Cannot connect to OMERO. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getFilesetImages(Browser client) + public List getFilesetImages(Browser browser) throws AccessException, ServiceException, ExecutionException { List related = new ArrayList<>(0); if (data.isFSImage()) { long fsId = this.asDataObject().getFilesetId(); String query = "select i from Image i where fileset=" + fsId; - List objects = client.findByQuery(query); + List objects = browser.findByQuery(query); Long[] ids = objects.stream() .map(IObject::getId) .map(RLong::getValue) .sorted() .toArray(Long[]::new); - related = client.getImages(ids); + related = browser.getImages(ids); } return related; } @@ -604,7 +604,7 @@ public List getROIFolders(Client client) /** * Gets the list of folders linked to this image. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -612,16 +612,16 @@ public List getROIFolders(Client client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getFolders(Browser client) + public List getFolders(Browser browser) throws ServiceException, AccessException, ExecutionException { String template = "select link.parent from FolderImageLink as link" + " where link.child.id=%d"; String query = String.format(template, getId()); - Long[] ids = client.findByQuery(query) - .stream() - .map(o -> o.getId().getValue()) - .toArray(Long[]::new); - return client.loadFolders(ids); + Long[] ids = browser.findByQuery(query) + .stream() + .map(o -> o.getId().getValue()) + .toArray(Long[]::new); + return browser.loadFolders(ids); } @@ -817,7 +817,7 @@ public ImagePlus toImagePlus(Client client, Bounds bounds) /** * Gets the image channels. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return the channels. * @@ -825,11 +825,11 @@ public ImagePlus toImagePlus(Client client, Bounds bounds) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getChannels(Browser client) + public List getChannels(Browser browser) throws ServiceException, AccessException, ExecutionException { String error = "Cannot get the channel name for " + this; - List channels = call(client.getMetadata(), - m -> m.getChannelData(client.getCtx(), + List channels = call(browser.getMetadata(), + m -> m.getChannelData(browser.getCtx(), getId()), error); return channels.stream() @@ -842,8 +842,8 @@ public List getChannels(Browser client) /** * Gets the name of the channel. * - * @param client The client handling the connection. - * @param index Channel number. + * @param browser The data browser. + * @param index Channel number. * * @return name of the channel. * @@ -851,17 +851,17 @@ public List getChannels(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public String getChannelName(Browser client, int index) + public String getChannelName(Browser browser, int index) throws ServiceException, AccessException, ExecutionException { - return getChannels(client).get(index).getChannelLabeling(); + return getChannels(browser).get(index).getChannelLabeling(); } /** * Gets the original color of the channel * - * @param client The client handling the connection. - * @param index Channel number. + * @param browser The data browser. + * @param index Channel number. * * @return Original color of the channel. * @@ -869,9 +869,9 @@ public String getChannelName(Browser client, int index) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public Color getChannelImportedColor(Browser client, int index) + public Color getChannelImportedColor(Browser browser, int index) throws ServiceException, AccessException, ExecutionException { - return getChannels(client).get(index).getColor(); + return getChannels(browser).get(index).getColor(); } @@ -945,7 +945,7 @@ public BufferedImage getThumbnail(Client client, int size) /** * Returns the original file paths where the image was imported from. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -953,11 +953,11 @@ public BufferedImage getThumbnail(Client client, int size) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getOriginalPaths(Browser client) + public List getOriginalPaths(Browser browser) throws ExecutionException, AccessException, ServiceException { String error = "Cannot get original paths for " + this; - return call(client.getMetadata(), - m -> m.getOriginalPaths(client.getCtx(), data), + return call(browser.getMetadata(), + m -> m.getOriginalPaths(browser.getCtx(), data), error); } @@ -965,7 +965,7 @@ public List getOriginalPaths(Browser client) /** * Returns the file paths of the image in the managed repository. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -973,11 +973,11 @@ public List getOriginalPaths(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getManagedRepositoriesPaths(Browser client) + public List getManagedRepositoriesPaths(Browser browser) throws ExecutionException, AccessException, ServiceException { String error = "Cannot get managed repositories paths for " + this; - return call(client.getMetadata(), - m -> m.getManagedRepositoriesPaths(client.getCtx(), data), + return call(browser.getMetadata(), + m -> m.getManagedRepositoriesPaths(browser.getCtx(), data), error); } diff --git a/src/main/java/fr/igred/omero/core/PixelsWrapper.java b/src/main/java/fr/igred/omero/core/PixelsWrapper.java index 465d5597..1b935d9d 100644 --- a/src/main/java/fr/igred/omero/core/PixelsWrapper.java +++ b/src/main/java/fr/igred/omero/core/PixelsWrapper.java @@ -141,16 +141,16 @@ private static int[] checkBounds(int[] bounds, int imageSize) { /** * Loads the planes information. * - * @param client The client handling the connection. + * @param browser The data browser. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public void loadPlanesInfo(Browser client) + public void loadPlanesInfo(Browser browser) throws ServiceException, AccessException, ExecutionException { - List planes = call(client.getMetadata(), - m -> m.getPlaneInfos(client.getCtx(), + List planes = call(browser.getMetadata(), + m -> m.getPlaneInfos(browser.getCtx(), data), "Cannot retrieve planes info."); planesInfo = wrap(planes, PlaneInfoWrapper::new); diff --git a/src/main/java/fr/igred/omero/screen/PlateAcquisitionWrapper.java b/src/main/java/fr/igred/omero/screen/PlateAcquisitionWrapper.java index 88c844fd..061a37bd 100644 --- a/src/main/java/fr/igred/omero/screen/PlateAcquisitionWrapper.java +++ b/src/main/java/fr/igred/omero/screen/PlateAcquisitionWrapper.java @@ -152,7 +152,7 @@ protected void link(Client client, A annotation) /** * Retrieves the screens containing the parent plates. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -160,17 +160,17 @@ protected void link(Client client, A annotation) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getScreens(Browser client) + public List getScreens(Browser browser) throws ServiceException, AccessException, ExecutionException { - PlateWrapper plate = client.getPlate(getRefPlateId()); - return plate.getScreens(client); + PlateWrapper plate = browser.getPlate(getRefPlateId()); + return plate.getScreens(browser); } /** * Returns the (updated) parent plate as a singleton list. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -178,16 +178,16 @@ public List getScreens(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getPlates(Browser client) + public List getPlates(Browser browser) throws ServiceException, AccessException, ExecutionException { - return client.getPlates(getRefPlateId()); + return browser.getPlates(getRefPlateId()); } /** * Retrieves the wells contained in the parent plate. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -195,9 +195,9 @@ public List getPlates(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getWells(Browser client) + public List getWells(Browser browser) throws ServiceException, AccessException, ExecutionException { - return getPlates(client).iterator().next().getWells(client); + return getPlates(browser).iterator().next().getWells(browser); } @@ -248,18 +248,18 @@ public List getImages() { /** * Retrieves the images contained in the wells in the parent plate. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. */ - public List getImages(Browser client) + public List getImages(Browser browser) throws ServiceException, AccessException { - return getWellSamples(client).stream() - .map(WellSampleWrapper::getImage) - .collect(Collectors.toList()); + return getWellSamples(browser).stream() + .map(WellSampleWrapper::getImage) + .collect(Collectors.toList()); } diff --git a/src/main/java/fr/igred/omero/screen/PlateWrapper.java b/src/main/java/fr/igred/omero/screen/PlateWrapper.java index b49249a1..c4bd422d 100644 --- a/src/main/java/fr/igred/omero/screen/PlateWrapper.java +++ b/src/main/java/fr/igred/omero/screen/PlateWrapper.java @@ -121,7 +121,7 @@ public void setDescription(String description) { /** * Retrieves the screens containing this plate. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -129,16 +129,16 @@ public void setDescription(String description) { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getScreens(Browser client) + public List getScreens(Browser browser) throws ServiceException, AccessException, ExecutionException { String query = "select link.parent from ScreenPlateLink as link" + " where link.child=" + getId(); - List os = client.findByQuery(query); - return client.getScreens(os.stream() - .map(IObject::getId) - .map(RLong::getValue) - .distinct() - .toArray(Long[]::new)); + List os = browser.findByQuery(query); + return browser.getScreens(os.stream() + .map(IObject::getId) + .map(RLong::getValue) + .distinct() + .toArray(Long[]::new)); } @@ -155,7 +155,7 @@ public List getPlateAcquisitions() { /** * Gets all wells in the plate available from OMERO. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -163,10 +163,10 @@ public List getPlateAcquisitions() { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getWells(Browser client) + public List getWells(Browser browser) throws ServiceException, AccessException, ExecutionException { - Collection wells = call(client.getBrowseFacility(), - bf -> bf.getWells(client.getCtx(), + Collection wells = call(browser.getBrowseFacility(), + bf -> bf.getWells(browser.getCtx(), data.getId()), "Cannot get wells from " + this); @@ -181,7 +181,7 @@ public List getWells(Browser client) /** * Returns the images contained in the wells of this plate. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -189,17 +189,17 @@ public List getWells(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImages(Browser client) + public List getImages(Browser browser) throws ServiceException, AccessException, ExecutionException { - return getWells(client).stream() - .map(WellWrapper::getImages) - .flatMap(Collection::stream) - .collect(toMap(ObjectWrapper::getId, - i -> i, (i1, i2) -> i1)) - .values() - .stream() - .sorted(Comparator.comparing(ObjectWrapper::getId)) - .collect(Collectors.toList()); + return getWells(browser).stream() + .map(WellWrapper::getImages) + .flatMap(Collection::stream) + .collect(toMap(ObjectWrapper::getId, + i -> i, (i1, i2) -> i1)) + .values() + .stream() + .sorted(Comparator.comparing(ObjectWrapper::getId)) + .collect(Collectors.toList()); } @@ -324,7 +324,7 @@ public Length getWellOriginY(UnitsLength unit) throws BigResult { /** * Reloads the plate from OMERO. * - * @param browser The client handling the connection. + * @param browser The data browser. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. diff --git a/src/main/java/fr/igred/omero/screen/ScreenWrapper.java b/src/main/java/fr/igred/omero/screen/ScreenWrapper.java index df4dfabb..3315bbac 100644 --- a/src/main/java/fr/igred/omero/screen/ScreenWrapper.java +++ b/src/main/java/fr/igred/omero/screen/ScreenWrapper.java @@ -162,7 +162,7 @@ public List getPlates(String name) { /** * Returns the plate acquisitions linked to this object, either directly, or through parents/children. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -170,9 +170,9 @@ public List getPlates(String name) { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getPlateAcquisitions(Browser client) + public List getPlateAcquisitions(Browser browser) throws ServiceException, AccessException, ExecutionException { - reload(client); + reload(browser); return getPlates().stream() .map(PlateWrapper::getPlateAcquisitions) .flatMap(Collection::stream) @@ -188,7 +188,7 @@ public List getPlateAcquisitions(Browser client) /** * Retrieves the wells linked to this object, either directly, or through parents/children. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -196,12 +196,12 @@ public List getPlateAcquisitions(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getWells(Browser client) + public List getWells(Browser browser) throws ServiceException, AccessException, ExecutionException { List plates = getPlates(); Collection> wells = new ArrayList<>(plates.size()); for (PlateWrapper p : plates) { - wells.add(p.getWells(client)); + wells.add(p.getWells(browser)); } return flatten(wells); } @@ -210,7 +210,7 @@ public List getWells(Browser client) /** * Retrieves the images contained in this screen. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above * @@ -218,12 +218,12 @@ public List getWells(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getImages(Browser client) + public List getImages(Browser browser) throws ServiceException, AccessException, ExecutionException { List plates = getPlates(); Collection> images = new ArrayList<>(plates.size()); for (PlateWrapper p : plates) { - images.add(p.getImages(client)); + images.add(p.getImages(browser)); } return flatten(images); } @@ -312,7 +312,7 @@ public void setReagentSetIdentifier(String value) { /** * Reloads the screen from OMERO. * - * @param browser The client handling the connection. + * @param browser The data browser. * * @throws ServiceException Cannot connect to OMERO. * @throws AccessException Cannot access data. diff --git a/src/main/java/fr/igred/omero/screen/WellSampleWrapper.java b/src/main/java/fr/igred/omero/screen/WellSampleWrapper.java index 1b7748cd..225671e7 100644 --- a/src/main/java/fr/igred/omero/screen/WellSampleWrapper.java +++ b/src/main/java/fr/igred/omero/screen/WellSampleWrapper.java @@ -55,7 +55,7 @@ public WellSampleWrapper(WellSampleData wellSample) { /** * Returns the screens containing the parent Well. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -63,16 +63,16 @@ public WellSampleWrapper(WellSampleData wellSample) { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getScreens(Browser client) + public List getScreens(Browser browser) throws ServiceException, AccessException, ExecutionException { - return getWell(client).getScreens(client); + return getWell(browser).getScreens(browser); } /** * Returns the plates containing the parent Well. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -80,9 +80,9 @@ public List getScreens(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getPlates(Browser client) + public List getPlates(Browser browser) throws ServiceException, AccessException, ExecutionException { - return Collections.singletonList(getWell(client).getPlate()); + return Collections.singletonList(getWell(browser).getPlate()); } @@ -99,7 +99,7 @@ public PlateAcquisitionWrapper getPlateAcquisition() { /** * Returns the plate acquisitions linked to the parent Well. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -107,16 +107,16 @@ public PlateAcquisitionWrapper getPlateAcquisition() { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getPlateAcquisitions(Browser client) + public List getPlateAcquisitions(Browser browser) throws ServiceException, AccessException, ExecutionException { - return getWell(client).getPlateAcquisitions(client); + return getWell(browser).getPlateAcquisitions(browser); } /** * Retrieves the well containing this well sample * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above * @@ -124,9 +124,9 @@ public List getPlateAcquisitions(Browser client) * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public WellWrapper getWell(Browser client) + public WellWrapper getWell(Browser browser) throws AccessException, ServiceException, ExecutionException { - return client.getWell(asDataObject().asWellSample().getWell().getId().getValue()); + return browser.getWell(asDataObject().asWellSample().getWell().getId().getValue()); } diff --git a/src/main/java/fr/igred/omero/screen/WellWrapper.java b/src/main/java/fr/igred/omero/screen/WellWrapper.java index 0d6066da..7f7c9515 100644 --- a/src/main/java/fr/igred/omero/screen/WellWrapper.java +++ b/src/main/java/fr/igred/omero/screen/WellWrapper.java @@ -122,7 +122,7 @@ public List getWellSamples() { /** * Reloads this well and retrieves the screens containing it. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above * @@ -130,10 +130,10 @@ public List getWellSamples() { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getScreens(Browser client) + public List getScreens(Browser browser) throws ServiceException, AccessException, ExecutionException { - reload(client); - return getPlate().getScreens(client); + reload(browser); + return getPlate().getScreens(browser); } @@ -150,7 +150,7 @@ public PlateWrapper getPlate() { /** * Reloads this well and returns the plate acquisitions linked to it. * - * @param client The client handling the connection. + * @param browser The data browser. * * @return See above. * @@ -158,10 +158,10 @@ public PlateWrapper getPlate() { * @throws AccessException Cannot access data. * @throws ExecutionException A Facility can't be retrieved or instantiated. */ - public List getPlateAcquisitions(Browser client) + public List getPlateAcquisitions(Browser browser) throws ServiceException, AccessException, ExecutionException { - reload(client); - return client.getPlate(getPlate().getId()).getPlateAcquisitions(); + reload(browser); + return browser.getPlate(getPlate().getId()).getPlateAcquisitions(); }