Skip to content

Commit

Permalink
Extract browser interfaces for each package
Browse files Browse the repository at this point in the history
  • Loading branch information
ppouchin committed Dec 1, 2024
1 parent 4473f35 commit dddc786
Show file tree
Hide file tree
Showing 9 changed files with 853 additions and 397 deletions.
5 changes: 2 additions & 3 deletions src/main/java/fr/igred/omero/AnnotatableWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,8 @@ protected void removeLinks(Client client, String linkType, Collection<Long> chil
String query = String.format(template, linkType, getId());
ParametersI param = new ParametersI();
param.addIds(childIds);
List<IObject> os = call(client.getGateway(),
g -> g.getQueryService(client.getCtx())
.findAllByQuery(query, param),
List<IObject> os = call(client.getQueryService(),
qs -> qs.findAllByQuery(query, param),
"Cannot get links from " + this);
client.delete(os);
}
Expand Down
126 changes: 126 additions & 0 deletions src/main/java/fr/igred/omero/annotations/AnnotationBrowser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
package fr.igred.omero.annotations;


import fr.igred.omero.exception.AccessException;
import fr.igred.omero.exception.ServiceException;
import omero.model.IObject;

import java.util.List;
import java.util.NoSuchElementException;
import java.util.concurrent.ExecutionException;


public interface AnnotationBrowser {


/**
* Finds objects on OMERO through a database query.
*
* @param query The database query.
*
* @return A list of OMERO objects.
*
* @throws ServiceException Cannot connect to OMERO.
* @throws AccessException Cannot access data.
*/
List<IObject> findByQuery(String query)
throws ServiceException, AccessException;


/**
* Gets the list of tag annotations available to the user.
*
* @return See above.
*
* @throws AccessException Cannot access data.
* @throws ServiceException Cannot connect to OMERO.
*/
List<TagAnnotation> getTags()
throws AccessException, ServiceException;


/**
* Gets the list of tag annotations with the specified name available to the user.
*
* @param name Name of the tag searched.
*
* @return See above.
*
* @throws AccessException Cannot access data.
* @throws ServiceException Cannot connect to OMERO.
*/
List<TagAnnotation> getTags(String name)
throws AccessException, ServiceException;


/**
* Gets a specific tag from the OMERO database.
*
* @param id ID of the tag.
*
* @return See above.
*
* @throws AccessException Cannot access data.
* @throws ServiceException Cannot connect to OMERO.
* @throws NoSuchElementException No element with this ID.
*/
TagAnnotationWrapper getTag(Long id)
throws AccessException, ServiceException;


/**
* Gets the list of map annotations available to the user.
*
* @return See above.
*
* @throws AccessException Cannot access data.
* @throws ServiceException Cannot connect to OMERO.
*/
List<MapAnnotation> getMapAnnotations()
throws AccessException, ServiceException;


/**
* Gets the list of map annotations with the specified key available to the user.
*
* @param key Name of the tag searched.
*
* @return See above.
*
* @throws AccessException Cannot access data.
* @throws ServiceException Cannot connect to OMERO.
*/
List<MapAnnotation> getMapAnnotations(String key)
throws AccessException, ServiceException;


/**
* Gets the list of map annotations with the specified key and value available to the user.
*
* @param key The required key.
* @param value The required value.
*
* @return See above.
*
* @throws AccessException Cannot access data.
* @throws ServiceException Cannot connect to OMERO.
*/
List<MapAnnotation> getMapAnnotations(String key, String value)
throws AccessException, ServiceException;


/**
* Gets a specific map annotation (key/value pairs) from the OMERO database.
*
* @param id ID of the map annotation.
*
* @return See above.
*
* @throws ServiceException Cannot connect to OMERO.
* @throws AccessException Cannot access data.
* @throws ExecutionException A Facility can't be retrieved or instantiated.
*/
MapAnnotation getMapAnnotation(Long id)
throws ServiceException, ExecutionException, AccessException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public List<Folder> getFolders(Browser browser)
* @throws ServiceException Cannot connect to OMERO.
* @throws AccessException Cannot access data.
*/
private List<IObject> getLinks(Browser browser, String linkType)
private List<IObject> getLinks(AnnotationBrowser browser, String linkType)
throws ServiceException, AccessException {
return browser.findByQuery("select link.parent from " + linkType +
" link where link.child = " + getId());
Expand Down
Loading

0 comments on commit dddc786

Please sign in to comment.