diff --git a/src/main/java/org/openmicroscopy/shoola/agents/measurement/view/MeasurementViewerModel.java b/src/main/java/org/openmicroscopy/shoola/agents/measurement/view/MeasurementViewerModel.java index 00af9acc5..e6b25c619 100644 --- a/src/main/java/org/openmicroscopy/shoola/agents/measurement/view/MeasurementViewerModel.java +++ b/src/main/java/org/openmicroscopy/shoola/agents/measurement/view/MeasurementViewerModel.java @@ -1309,9 +1309,6 @@ void deleteFolders(Collection folders) { /** * Add ROIs to Folders - * - * @param selectedObjects - * The ROIs * @param folders * The Folders * @param async @@ -1337,16 +1334,7 @@ Collection saveROIFolders(Collection folders, try { Registry reg = MetadataViewerAgent.getRegistry(); OmeroDataService ods = reg.getDataService(); - Gateway gw = ods.getGateway(); - DataManagerFacility dm = gw - .getFacility(DataManagerFacility.class); - List objs = new ArrayList(folders.size()); - for (FolderData f : folders) - objs.add(f.asIObject()); - objs = dm.saveAndReturnObject(getSecurityContext(), objs, null, - null); - Collection result = PojoMapper - .asCastedDataObjects(objs); + Collection result = ods.saveROIFolders(getSecurityContext(), folders); Collection ids = Pojos.extractIds(this.folders); for (FolderData f : result) { if (!ids.contains(f.getId())) diff --git a/src/main/java/org/openmicroscopy/shoola/env/data/DataServicesFactory.java b/src/main/java/org/openmicroscopy/shoola/env/data/DataServicesFactory.java index d5ecf0525..70994d207 100644 --- a/src/main/java/org/openmicroscopy/shoola/env/data/DataServicesFactory.java +++ b/src/main/java/org/openmicroscopy/shoola/env/data/DataServicesFactory.java @@ -144,9 +144,6 @@ public static DataServicesFactory getInstance(Container c) /** The Administration service adapter. */ private AdminService admin; - /** Flag indicating that we try to re-establish the connection.*/ - private final AtomicBoolean reconnecting = new AtomicBoolean(false); - /** * Attempts to create a new instance. * @@ -262,7 +259,6 @@ public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (NotificationDialog.CLOSE_NOTIFICATION_PROPERTY.equals(name)) { - reconnecting.set(false); connectionDialog = null; exitApplication(true, true); } else if ( @@ -270,7 +266,6 @@ public void propertyChange(PropertyChangeEvent evt) { name)) { connectionDialog = null; - reconnecting.set(false); int index = (Integer) evt.getNewValue(); if (index == ConnectionExceptionHandler.LOST_CONNECTION) reconnect(); @@ -335,7 +330,6 @@ private void reconnect() connectionDialog.setVisible(false); connectionDialog.dispose(); connectionDialog = null; - reconnecting.set(false); } else { //connectionDialog.setVisible(false); message = "A failure occurred while attempting to " + @@ -368,8 +362,8 @@ int runAsPlugin() */ public void sessionExpiredExit(int index, Throwable exc) { - if (reconnecting.get()) return; - reconnecting.set(true); + if (connectionDialog != null && connectionDialog.isVisible()) + return; String message; if (exc != null) { LogMessage msg = new LogMessage(); diff --git a/src/main/java/org/openmicroscopy/shoola/env/data/OMEROGateway.java b/src/main/java/org/openmicroscopy/shoola/env/data/OMEROGateway.java index fb4ac5663..20afc1f85 100644 --- a/src/main/java/org/openmicroscopy/shoola/env/data/OMEROGateway.java +++ b/src/main/java/org/openmicroscopy/shoola/env/data/OMEROGateway.java @@ -42,6 +42,9 @@ import java.util.Map.Entry; import java.util.concurrent.ExecutionException; +import omero.gateway.facility.RawDataFacility; +import omero.gateway.model.FolderData; +import omero.gateway.model.PixelsData; import org.apache.commons.collections4.CollectionUtils; import org.openmicroscopy.shoola.util.CommonsLangUtils; @@ -1394,7 +1397,6 @@ else if (FileAnnotationData.class.getName().equals(data)) * @return The {@link ExperimenterData} of the current user. * @throws DSOutOfServiceException If the connection is broken, or * logged in. - * @see IPojosPrx#getUserDetails(Set, Map) */ ExperimenterData getUserDetails(SecurityContext ctx, String name, boolean connectionError) @@ -1439,7 +1441,7 @@ String getSessionId(ExperimenterData user) { /** * Get the omero client properties from the server - * @param The groupId for the {@link SecurityContext} + * @param groupId The groupId for the {@link SecurityContext} * @return See above. * @throws DSAccessException * @throws DSOutOfServiceException @@ -1458,7 +1460,7 @@ Map getOmeroClientProperties(long groupId) /** * Get the server properties from the server - * @param The groupId for the {@link SecurityContext} + * @param groupId The groupId for the {@link SecurityContext} * @return See above. * @throws DSAccessException * @throws DSOutOfServiceException @@ -1638,7 +1640,6 @@ void logout() { * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#loadContainerHierarchy(Class, List, Map) */ Collection loadContainerHierarchy(SecurityContext ctx, Class rootType, List rootIDs, Parameters options) @@ -1660,9 +1661,8 @@ Collection loadContainerHierarchy(SecurityContext ctx, Class rootTyp * contain the specified Images. * The annotation for the current user is also linked to the object. * Annotations are currently possible only for Image and Dataset. - * Wraps the call to the - * {@link IPojos#findContainerHierarchies(Class, List, Map)} - * and maps the result calling {@link PojoMapper#convertToDataObjects(Set)}. + * Wraps the call to the findContainerHierarchies(Class, List, Map) + * and maps the result calling convertToDataObjects(Set). * * @param ctx The security context, necessary to determine the service. * @param rootNodeType top-most type which will be searched for @@ -1675,7 +1675,6 @@ Collection loadContainerHierarchy(SecurityContext ctx, Class rootTyp * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#findContainerHierarchies(Class, List, Map) */ Collection findContainerHierarchy(SecurityContext ctx, Class rootNodeType, List leavesIDs, Parameters options) @@ -1718,7 +1717,6 @@ Collection findContainerHierarchy(SecurityContext ctx, Class rootNod * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#findAnnotations(Class, List, List, Map) */ Map loadAnnotations(SecurityContext ctx, Class nodeType, List nodeIDs, List annotationTypes, List annotatorIDs, Parameters options) @@ -1808,8 +1806,8 @@ Collection findAllAnnotations(SecurityContext ctx, Class type, long userID) /** * Retrieves the images contained in containers specified by the * node type. - * Wraps the call to the {@link IPojos#getImages(Class, List, Parameters)} - * and maps the result calling {@link PojoMapper#convertToDataObjects(Set)}. + * Wraps the call to the getImages(Class, List, Parameters) + * and maps the result calling convertToDataObjects(Set). * * @param ctx The security context. * @param nodeType The type of container. Can be either Project, Dataset. @@ -1819,7 +1817,6 @@ Collection findAllAnnotations(SecurityContext ctx, Class type, long userID) * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#getImages(Class, List, Map) */ Collection getContainerImages(SecurityContext ctx, Class nodeType, List nodeIDs, Parameters options) @@ -1849,7 +1846,6 @@ Collection getContainerImages(SecurityContext ctx, Class nodeType, Li * @throws DSAccessException * If an error occurred while trying to retrieve data from OMERO * service. - * @see IPojos#getUserImages(Map) */ Collection getUserImages(SecurityContext ctx, long userID, boolean orphan) throws DSOutOfServiceException, DSAccessException { @@ -1876,12 +1872,10 @@ Collection getUserImages(SecurityContext ctx, long userID, boolean or * @param property One of the properties defined by this class. * @param ids The identifiers of the objects. * @param options Options to retrieve the data. - * @param rootNodeIDs Set of root node IDs. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#getCollectionCount(String, String, List, Map) */ Map getCollectionCount(SecurityContext ctx, Class rootNodeType, String property, List ids, Parameters options) @@ -1908,12 +1902,10 @@ Map getCollectionCount(SecurityContext ctx, Class rootNodeType, * * @param ctx The security context. * @param object The object to create. - * @param options Options to create the data. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#createDataObject(IObject, Map) */ IObject createObject(SecurityContext ctx, IObject object) throws DSOutOfServiceException, DSAccessException @@ -1926,13 +1918,11 @@ IObject createObject(SecurityContext ctx, IObject object) * * @param ctx The security context. * @param object The object to create. - * @param options Options to create the data. * @param userName The name of the user to create data for. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#createDataObject(IObject, Map) */ IObject createObject(SecurityContext ctx, IObject object, String userName) throws DSOutOfServiceException, DSAccessException @@ -1950,12 +1940,10 @@ IObject createObject(SecurityContext ctx, IObject object, String userName) * * @param ctx The security context. * @param objects The objects to create. - * @param options Options to create the data. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#createDataObjects(IObject[], Map) */ List createObjects(SecurityContext ctx, List objects) throws DSOutOfServiceException, DSAccessException @@ -1968,13 +1956,11 @@ List createObjects(SecurityContext ctx, List objects) * * @param ctx The security context. * @param objects The objects to create. - * @param options Options to create the data. * @param userName The name of the user.s * @return See above. * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#createDataObjects(IObject[], Map) */ List createObjects(SecurityContext ctx, List objects, String userName) @@ -2040,7 +2026,6 @@ void deleteObjects(SecurityContext ctx, List objects) * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#updateDataObject(IObject, Map) */ IObject saveAndReturnObject(SecurityContext ctx, IObject object, Map options) @@ -2067,7 +2052,6 @@ IObject saveAndReturnObject(SecurityContext ctx, IObject object, * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#updateDataObject(IObject, Map) */ IObject saveAndReturnObject(SecurityContext ctx, IObject object, Map options, String userName) @@ -2094,7 +2078,6 @@ IObject saveAndReturnObject(SecurityContext ctx, IObject object, * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#updateDataObject(IObject, Map) */ List saveAndReturnObject(SecurityContext ctx, List objects, Map options, String userName) @@ -2119,7 +2102,6 @@ List saveAndReturnObject(SecurityContext ctx, * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#updateDataObject(IObject, Map) */ IObject updateObject(SecurityContext ctx, IObject object, Parameters options) @@ -2146,7 +2128,6 @@ IObject updateObject(SecurityContext ctx, IObject object, * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. - * @see IPojos#updateDataObjects(IObject[], Map) */ List updateObjects(SecurityContext ctx, List objects, Parameters options) @@ -2920,7 +2901,7 @@ IObject findIObject(SecurityContext ctx, IObject o) * Retrieves an updated version of the specified object. * * @param ctx The security context. - * @param dataObjectThe object to retrieve. + * @param dataObject The object to retrieve. * @param name The name of the object. * @param * @throws DSOutOfServiceException If the connection is broken, or not logged in @@ -3022,7 +3003,7 @@ IObject findIObject(SecurityContext ctx, String klassName, long id, boolean allG * Retrieves the groups visible by the current experimenter. * * @param ctx The security context. - * @param loggedInUser The user currently logged in. + * @param user The user currently logged in. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to @@ -3805,7 +3786,7 @@ private byte[] retrievePlane(SecurityContext ctx, * including nested sub-directories. * * @param ctx The security context. - * @param Either a group or a user. + * @param type Either a group or a user. * @param id The identifier of the user or group or -1 * if not specified. * @return See above. @@ -3832,7 +3813,7 @@ long getFreeSpace(SecurityContext ctx, Class type, long id) * including nested sub-directories. * * @param ctx The security context. - * @param Either a group or a user. + * @param type Either a group or a user. * @param id The identifier of the user or group or -1 * if not specified. * @return See above. @@ -4131,8 +4112,6 @@ Map> getRenderingSettings( * @param ctx The security context. * @param pixelsID The pixels ID. * @param userID The id of the user. - * @param convert Pass true to convert the object, - * false otherwise. * @return Map whose key is the experimenter who set the settings, * and the value is the rendering settings itself. * @throws DSOutOfServiceException If the connection is broken, or logged @@ -4835,7 +4814,6 @@ Map getDataObjectsTaggedCount(SecurityContext ctx, List rootNodeIDs) * @param stepping The stepping used to project. Default is 1. * @param algorithm The projection's algorithm. * @param channels The channels to project. - * @param datasets The collection of datasets to add the image to. * @param name The name of the projected image. * @param pixType The destination Pixels type. If null, the * source Pixels set pixels type will be used. @@ -5355,10 +5333,7 @@ void fillEnumerations(SecurityContext ctx) * Creates a movie. Returns the id of the annotation hosting the movie. * * @param ctx The security context. - * @param imageID The id of the image. - * @param pixelsID The id of the pixels. - * @param userID The id of the user. - * @param channels The channels to map. + * @param userID The id of the user. * @param param The parameters to create the movie. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or logged @@ -5466,7 +5441,6 @@ ScriptCallback createMovie(SecurityContext ctx, long imageID, long pixelsID, * Returns all the scripts that the user can run. * * @param ctx The security context. - * @param experimenter The experimenter or null. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or logged * in. @@ -5900,10 +5874,6 @@ Object importImageFile(SecurityContext ctx, ImportableObject object, * @param ctx The security context. * @param object Host information about the file to import. * @param file The file to import. - * @param archived Pass true to archived the files, - * false otherwise. - * @param depth The depth used to set the name. This will be taken into - * account if the file is a directory. * @return See above. * @throws ImportException If an error occurred while importing. */ @@ -6184,10 +6154,9 @@ Collection loadROIMeasurements(SecurityContext ctx, long imageID, * Returns the file * * @param index Either OME-XML or OME-TIFF. - * @param file The file to write the bytes. * @param imageID The id of the image. * @param ctx The security context. - * @param file The file to write the bytes. + * @param f The file to write the bytes. * @param imageID The id of the image. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or logged @@ -6526,7 +6495,7 @@ GroupData createGroup(SecurityContext ctx, AdminObject object, Roles roles) * number of experimenters in the group. * * @param ctx The security context. - * @param ids The group identifiers. + * @param groupIds The group identifiers. * @return See above * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to @@ -6695,7 +6664,7 @@ List loadGroupsForExperimenter(SecurityContext ctx, long id) * experimenters if the value passed is -1. * * @param ctx The security context. - * @param id The group identifier or -1. + * @param groupID The group identifier or -1. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or logged * in. @@ -7042,8 +7011,7 @@ private byte[] retrieveUserPhoto(SecurityContext ctx, * Uploads the photo hosting the user photo. * * @param ctx The security context. - * @param fileID The id of the file. - * @param size The size of the file. + * @param file The file. * @return See above * @throws DSOutOfServiceException If the connection is broken, or logged * in. @@ -7259,7 +7227,6 @@ boolean canDelete(IObject ho) * Retrieves the dimensions in microns of the specified pixels set. * * @param ctx The security context. - * @param pixelsID The pixels set ID. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to @@ -7407,7 +7374,7 @@ void shutDownDerivedConnector(SecurityContext ctx) * @param rootIDs The collection of object's ids the annotations are linked * to. * @param nsInclude The annotation's name space to include if any. - * @param nsExlcude The annotation's name space to exclude if any. + * @param nsExclude The annotation's name space to exclude if any. * @param options Options to retrieve the data. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or not logged in @@ -7581,4 +7548,52 @@ boolean canCreate(SecurityContext ctx) return value.booleanValue(); } + public Collection getLookupTables(SecurityContext ctx) throws DSOutOfServiceException, DSAccessException { + try { + return gw.getFacility(BrowseFacility.class).getLookupTables(ctx); + } catch (Exception e) { + handleException(e, "Cannot retrieve lookup tables."); + } + return null; + } + + public Map getHistogram(SecurityContext ctx, + PixelsData pixels, + int[] channels, int z, int t) + throws DSOutOfServiceException, DSAccessException { + try { + RawDataFacility f = gw.getFacility(RawDataFacility.class); + return f.getHistogram(ctx, pixels, channels, z, t); + } catch (Exception e) { + handleException(e, "Cannot retrieve lookup tables."); + } + return null; + } + + public int getROICount(SecurityContext ctx, long imageId) throws DSOutOfServiceException, DSAccessException { + try { + return gw.getFacility(ROIFacility.class).getROICount(ctx, imageId); + } catch (Exception e) { + handleException(e, "Cannot retrieve ROI count."); + } + return -1; + } + + public Collection saveROIFolders(SecurityContext ctx, Collection folders) + throws DSOutOfServiceException, DSAccessException { + try { + DataManagerFacility dm = this.gw.getFacility(DataManagerFacility.class); + List objs = new ArrayList(folders.size()); + for (FolderData f : folders) + objs.add(f.asIObject()); + objs = dm.saveAndReturnObject(ctx, objs, null, + null); + Collection result = PojoMapper + .asCastedDataObjects(objs); + return result; + } catch (Exception e) { + handleException(e, "Cannot save ROI folders"); + } + return Collections.EMPTY_LIST; + } } diff --git a/src/main/java/org/openmicroscopy/shoola/env/data/OmeroDataService.java b/src/main/java/org/openmicroscopy/shoola/env/data/OmeroDataService.java index 4ddd3e64f..acb8d1045 100644 --- a/src/main/java/org/openmicroscopy/shoola/env/data/OmeroDataService.java +++ b/src/main/java/org/openmicroscopy/shoola/env/data/OmeroDataService.java @@ -26,9 +26,11 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ExecutionException; import omero.api.StatefulServiceInterfacePrx; +import omero.gateway.model.FolderData; import org.openmicroscopy.shoola.env.data.model.DeletableObject; import omero.gateway.Gateway; @@ -58,12 +60,6 @@ public interface OmeroDataService */ public static final String IMAGES_PROPERTY = "images"; - /** - * Get a reference to the {@link Gateway} - * @return See above - */ - public Gateway getGateway(); - /** * Retrieves hierarchy trees rooted by a given node. * i.e. the requested node as root and all of its descendants. @@ -506,5 +502,11 @@ public Map>> getImagesBySplitFilesets( * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. */ - public Map> findDatasetsByImageId(SecurityContext ctx, List imgIds) throws DSOutOfServiceException, DSAccessException; + public Map> findDatasetsByImageId(SecurityContext ctx, List imgIds) + throws DSOutOfServiceException, DSAccessException; + + public Collection saveROIFolders(SecurityContext ctx, Collection folders) + throws ExecutionException, DSOutOfServiceException, DSAccessException; + + public int getROICount(SecurityContext ctx, long imageId) throws DSOutOfServiceException, DSAccessException; } diff --git a/src/main/java/org/openmicroscopy/shoola/env/data/OmeroDataServiceImpl.java b/src/main/java/org/openmicroscopy/shoola/env/data/OmeroDataServiceImpl.java index 84ddbfabb..db49ee65a 100644 --- a/src/main/java/org/openmicroscopy/shoola/env/data/OmeroDataServiceImpl.java +++ b/src/main/java/org/openmicroscopy/shoola/env/data/OmeroDataServiceImpl.java @@ -31,9 +31,12 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.concurrent.ExecutionException; import omero.cmd.Request; import omero.cmd.graphs.ChildOption; +import omero.gateway.facility.DataManagerFacility; +import omero.gateway.model.FolderData; import omero.model.Annotation; import omero.model.AnnotationAnnotationLink; import omero.model.Dataset; @@ -115,11 +118,6 @@ class OmeroDataServiceImpl /** Reference to the entry point to access the OMERO services. */ private OMEROGateway gateway; - @Override - public Gateway getGateway() { - return gateway.getGateway(); - } - /** * Unlinks the collection of children from the specified parent. * @@ -494,7 +492,6 @@ public void cutAndPaste(SecurityContext ctx, Map toPaste, Map toCut) /** * Implemented as specified by {@link OmeroDataService}. - * @see OmeroDataService#getArchivedFiles(SecurityContext, File, long, boolean) */ public Map getArchivedImage(SecurityContext ctx, File file, long imageID, boolean keepOriginalPath) @@ -508,7 +505,6 @@ public Map getArchivedImage(SecurityContext ctx, /** * Implemented as specified by {@link OmeroDataService}. - * @see OmeroDataService#updateExperimenter(SecurityContext, ExperimenterData, GroupData) */ public ExperimenterData updateExperimenter(SecurityContext ctx, ExperimenterData exp, GroupData group) @@ -589,7 +585,6 @@ public List getImagesAllPeriodCount(SecurityContext ctx, /** * Implemented as specified by {@link OmeroDataService}. - * @see OmeroDataService#advancedSearchFor(List, SearchDataContext) */ public SearchResultCollection search(SecurityContext ctx, SearchParameters context) @@ -730,7 +725,7 @@ private void initializeImages(SearchResultCollection results) { /** * Tries to convert all search terms into ids; - * @param terms + * @param query terms * @return The ids or null if one or multiple terms contain non numeric characters */ private long[] convertSearchTermsToIds(String query) { @@ -1148,7 +1143,6 @@ public Map>> getImagesBySplitFilesets( /** * Implemented as specified by {@link OmeroDataService}. - * @see OmeroDataService#findDatasetsByImageId(SecurityContext ctx, imgId) */ public Map> findDatasetsByImageId(SecurityContext ctx, List imgIds) throws DSOutOfServiceException, DSAccessException { @@ -1173,4 +1167,12 @@ public Map> findDatasetsByImageId(SecurityContext ctx, L return result; } + public Collection saveROIFolders(SecurityContext ctx, Collection folders) + throws DSOutOfServiceException, DSAccessException { + return gateway.saveROIFolders(ctx, folders); + } + + public int getROICount(SecurityContext ctx, long imageId) throws DSOutOfServiceException, DSAccessException { + return gateway.getROICount(ctx, imageId); + } } diff --git a/src/main/java/org/openmicroscopy/shoola/env/data/OmeroImageService.java b/src/main/java/org/openmicroscopy/shoola/env/data/OmeroImageService.java index 500cc92f8..19c396822 100644 --- a/src/main/java/org/openmicroscopy/shoola/env/data/OmeroImageService.java +++ b/src/main/java/org/openmicroscopy/shoola/env/data/OmeroImageService.java @@ -862,4 +862,9 @@ RndProxyDef getSettings(SecurityContext ctx, long rndID) */ RawPixelsStorePrx createPixelsStore(SecurityContext ctx) throws DSAccessException, DSOutOfServiceException; + + public Map getHistogram(SecurityContext ctx, + PixelsData pixels, + int[] channels, int z, int t) throws DSAccessException, + DSOutOfServiceException; } diff --git a/src/main/java/org/openmicroscopy/shoola/env/data/OmeroImageServiceImpl.java b/src/main/java/org/openmicroscopy/shoola/env/data/OmeroImageServiceImpl.java index 5bdc7f8e3..3b88b2846 100644 --- a/src/main/java/org/openmicroscopy/shoola/env/data/OmeroImageServiceImpl.java +++ b/src/main/java/org/openmicroscopy/shoola/env/data/OmeroImageServiceImpl.java @@ -214,10 +214,8 @@ private int getNumberOfRenderingEngines(SecurityContext ctx, long pixelsID) * Imports the specified candidates. * * @param ctx The security context. - * @param candidates The file to import. * @param status The original status. * @param object The object hosting information about the import. - * @param ioList The containers where to import the files. * @param list The list of annotations. * @param userID The identifier of the user. * @param hcs Value returns by the import containers. @@ -327,9 +325,9 @@ private BufferedImage createImage(byte[] values) } /** - * Creates a BufferedImage from the passed array of bytes. + * Creates a BufferedImage from the passed path. * - * @param values The array of bytes. + * @param path The path, * @return See above. * @throws RenderingServiceException If we cannot create an image. */ @@ -570,8 +568,7 @@ private Collection getLookupTables(SecurityContext ctx) { return OmeroImageServiceImpl.LOOKUP_TABLES; try { - OmeroImageServiceImpl.LOOKUP_TABLES = gateway.getGateway() - .getFacility(BrowseFacility.class).getLookupTables(ctx); + OmeroImageServiceImpl.LOOKUP_TABLES = gateway.getLookupTables(ctx); return OmeroImageServiceImpl.LOOKUP_TABLES; } catch (Exception e) { context.getLogger().warn(this, e.getMessage()); @@ -644,7 +641,6 @@ public BufferedImage getThumbnail(SecurityContext ctx,long pixID, int sizeX, /** * Implemented as specified by {@link OmeroImageService}. - * @see OmeroImageService#getThumbnailSet(SecurityContext, List, int) */ public Map getThumbnailSet(SecurityContext ctx, Collection pixelsID, int max) @@ -839,7 +835,6 @@ public Map pasteRenderingSettings(SecurityContext ctx, long pixelsID, /** * Implemented as specified by {@link OmeroImageService}. - * @see OmeroImageService#resetRenderingSettings(Class, List) */ public Map resetRenderingSettings(SecurityContext ctx, Class rootNodeType, List nodesID) @@ -879,7 +874,6 @@ public Map setOwnerRenderingSettings(SecurityContext ctx, /** * Implemented as specified by {@link OmeroImageService}. - * @see OmeroImageService#getRenderingSettings(ctx, long, long) */ public Map> getRenderingSettings( SecurityContext ctx, long pixelsID, long userID) @@ -890,7 +884,6 @@ public Map> getRenderingSettings( /** * Implemented as specified by {@link OmeroImageService}. - * @see OmeroImageService#getRenderingSettingsFor(long, long) */ public List getRenderingSettingsFor(SecurityContext ctx, long pixelsID, long userID) @@ -1026,8 +1019,6 @@ private boolean isHCS(List containers) /** * Implemented as specified by {@link OmeroImageService}. - * @see OmeroImageService#importFile(ImportableObject, - * ImportableFile, long, long, boolean) */ public Object importFile(ImportableObject object, ImportableFile importable, boolean close) @@ -1595,8 +1586,6 @@ private File applyTransforms(File inputXML, List transforms, /** * Implemented as specified by {@link OmeroImageService}. - * @see OmeroImageService#exportImageAsOMEObject(SecurityContext, int, long, - * File, Target) */ public Object exportImageAsOMEFormat(SecurityContext ctx, int index, long imageID, File file, Target target) @@ -1797,7 +1786,6 @@ public Object uploadScript(SecurityContext ctx, ScriptObject script) /** * Implemented as specified by {@link OmeroDataService}. - * @see OmeroImageService#loadRatings(SecurityContext, Class, long, long) */ public Collection loadROIMeasurements(SecurityContext ctx, Class type, long id, long userID) @@ -2022,7 +2010,6 @@ public Long getRenderingDef(SecurityContext ctx, long pixelsID, /** * Implemented as specified by {@link OmeroDataService}. - * @see OmeroImageService#getRenderingDef(SecurityContext, long) */ public RndProxyDef getSettings(SecurityContext ctx, long rndID) throws DSOutOfServiceException, DSAccessException @@ -2045,4 +2032,10 @@ public RawPixelsStorePrx createPixelsStore(SecurityContext ctx) return null; } + public Map getHistogram(SecurityContext ctx, + PixelsData pixels, + int[] channels, int z, int t) throws DSOutOfServiceException, + DSAccessException { + return gateway.getHistogram(ctx, pixels, channels, z, t); + } } diff --git a/src/main/java/org/openmicroscopy/shoola/env/data/views/calls/HistogramLoader.java b/src/main/java/org/openmicroscopy/shoola/env/data/views/calls/HistogramLoader.java index 04724cb45..0e2afed27 100644 --- a/src/main/java/org/openmicroscopy/shoola/env/data/views/calls/HistogramLoader.java +++ b/src/main/java/org/openmicroscopy/shoola/env/data/views/calls/HistogramLoader.java @@ -23,7 +23,6 @@ import java.util.Map; import omero.gateway.SecurityContext; -import omero.gateway.facility.RawDataFacility; import omero.gateway.model.ImageData; import org.openmicroscopy.shoola.env.data.views.BatchCall; @@ -61,11 +60,8 @@ public HistogramLoader(final SecurityContext ctx, final ImageData img, final int final int z, final int t) { loadCall = new BatchCall("Loading Histogram data") { public void doCall() throws Exception { - try (RawDataFacility f = context.getGateway().getFacility( - RawDataFacility.class)) { - result = f.getHistogram(ctx, img.getDefaultPixels(), - channels, z, t); - } + result = context.getImageService().getHistogram(ctx, img.getDefaultPixels(), + channels, z, t); } }; } diff --git a/src/main/java/org/openmicroscopy/shoola/env/data/views/calls/ROICountLoader.java b/src/main/java/org/openmicroscopy/shoola/env/data/views/calls/ROICountLoader.java index 544cceac6..ffd6e9fe7 100644 --- a/src/main/java/org/openmicroscopy/shoola/env/data/views/calls/ROICountLoader.java +++ b/src/main/java/org/openmicroscopy/shoola/env/data/views/calls/ROICountLoader.java @@ -23,7 +23,6 @@ package org.openmicroscopy.shoola.env.data.views.calls; import omero.gateway.SecurityContext; -import omero.gateway.facility.ROIFacility; import org.openmicroscopy.shoola.env.data.views.BatchCall; import org.openmicroscopy.shoola.env.data.views.BatchCallTree; @@ -46,8 +45,7 @@ private BatchCall makeLoadCalls(final SecurityContext ctx, final long imageID) { return new BatchCall("Load ROI count from Server") { public void doCall() throws Exception { - results = context.getGateway().getFacility(ROIFacility.class) - .getROICount(ctx, imageID); + results = context.getDataService().getROICount(ctx, imageID); } }; } diff --git a/src/test/java/org/openmicroscopy/shoola/env/data/NullOmeroPojoService.java b/src/test/java/org/openmicroscopy/shoola/env/data/NullOmeroPojoService.java index 7f6422708..72b4e8b9d 100644 --- a/src/test/java/org/openmicroscopy/shoola/env/data/NullOmeroPojoService.java +++ b/src/test/java/org/openmicroscopy/shoola/env/data/NullOmeroPojoService.java @@ -27,9 +27,11 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ExecutionException; import omero.api.StatefulServiceInterfacePrx; +import omero.gateway.model.FolderData; import org.openmicroscopy.shoola.env.data.model.DeletableObject; import org.openmicroscopy.shoola.env.data.util.SearchDataContext; @@ -464,7 +466,17 @@ public Map> findDatasetsByImageId(SecurityContext ctx, return null; } - /** + @Override + public Collection saveROIFolders(SecurityContext ctx, Collection folders) throws ExecutionException, DSOutOfServiceException, DSAccessException { + return null; + } + + @Override + public int getROICount(SecurityContext ctx, long imageId) throws DSOutOfServiceException, DSAccessException { + return 0; + } + + /** * No-operation implementation * @see OmeroDataService#search(SecurityContext, SearchParameters) */ @@ -484,9 +496,7 @@ public SearchResultCollection search(SecurityContext ctx, return null; } - @Override public Gateway getGateway() { - // TODO Auto-generated method stub return null; } } diff --git a/src/test/java/org/openmicroscopy/shoola/env/data/NullRenderingService.java b/src/test/java/org/openmicroscopy/shoola/env/data/NullRenderingService.java index def0d6f2e..9d3d1679e 100644 --- a/src/test/java/org/openmicroscopy/shoola/env/data/NullRenderingService.java +++ b/src/test/java/org/openmicroscopy/shoola/env/data/NullRenderingService.java @@ -529,4 +529,9 @@ public RawPixelsStorePrx createPixelsStore(SecurityContext ctx) throws DSAccessException, DSOutOfServiceException { return null; } + + @Override + public Map getHistogram(SecurityContext ctx, PixelsData pixels, int[] channels, int z, int t) throws DSAccessException, DSOutOfServiceException { + return null; + } }