@RolesAllowed("user") public List<Experimenter> lookupExperimenters() { return iQuery.findAllByQuery("select distinct e from Experimenter e " + "left outer join fetch e.groupExperimenterMap m " + "left outer join fetch m.parent g", null); }
@RolesAllowed("user") public List<ExperimenterGroup> lookupGroups() { return iQuery.findAllByQuery("select distinct g from ExperimenterGroup g " + "left outer join fetch g.groupExperimenterMap m " + "left outer join fetch m.child u " + "left outer join fetch u.groupExperimenterMap m2 " + "left outer join fetch m2.parent", null); }
protected List<Experimenter> loadMembers(ShareData data) { List<Experimenter> members = new ArrayList<Experimenter>(); if (data.members.size() > 0) members = iQuery.findAllByQuery("select e from Experimenter e " + "where e.id in (:ids)", new Parameters() .addIds(data.members)); return members; }
@RolesAllowed("user") public ExperimenterGroup[] containedGroups(long experimenterId) { List<ExperimenterGroup> groups = iQuery .findAllByQuery( "select distinct g from ExperimenterGroup as g " + "join fetch g.groupExperimenterMap as map " + "join fetch map.parent e " + "left outer join fetch map.child u " + "left outer join fetch u.groupExperimenterMap m2 " + "where g.id in " + " (select m.parent from GroupExperimenterMap m " + " where m.child.id = :id )", new Parameters().addId(experimenterId)); return groups.toArray(new ExperimenterGroup[groups.size()]); }
@RolesAllowed("user") public Experimenter[] containedExperimenters(long groupId) { List<Experimenter> experimenters = iQuery.findAllByQuery( "select distinct e from Experimenter as e " + "join fetch e.groupExperimenterMap as map " + "join fetch map.parent g " + "where e.id in " + " (select m.child from GroupExperimenterMap m " + " where m.parent.id = :id )", new Parameters() .addId(groupId)); return experimenters.toArray(new Experimenter[experimenters.size()]); }
public void runAsAdmin() { String dsQuery; if (force) { dsQuery = dsNotOwnQuery; p.addLong("owner", iAdmin.getEventContext().getCurrentUserId()); } else { dsQuery = dsAllQuery; } rv.addAll(iQuery.findAllByQuery(dsQuery, p)); // TODO What about categories of other users? }
sb.append("where ann.id in (:ids)"); List<A> list = iQuery.findAllByQuery(sb.toString(), new Parameters().addIds(annotationIds)); if (list == null) return new HashSet<A>();
@RolesAllowed("user") public synchronized void prepare(Set<Long> pixelsIds) { pixelsCache = new MapMaker().makeMap(); List<Pixels> pixelsList = iQuery.findAllByQuery( "select p from Pixels as p join fetch p.pixelsType " + "where p.id in (:ids)", new Parameters().addIds(pixelsIds)); for (Pixels pixels : pixelsList) { pixelsCache.put(pixels.getId(), pixels); } }
@Override @RolesAllowed("user") public List<IObject> retrieveAllRndSettings(long pixId, long userId) { Parameters params = new Parameters(); params.addLong("p_id", pixId); String restriction = "rdef.pixels.id = :p_id "; if (userId >= 0) { restriction += "and rdef.details.owner.id = :o_id "; params.addLong("o_id", userId); } List<IObject> l = iQuery.findAllByQuery( RENDERING_DEF_QUERY_PREFIX +restriction + "order by rdef.details.updateEvent.time desc", params); return l; }
@RolesAllowed("user") @Transactional(readOnly = false) public void deleteComment(@NotNull Annotation comment) { List<SessionAnnotationLink> links = iQuery.findAllByQuery( "select l from SessionAnnotationLink l " + "where l.child.id = :id", new Parameters() .addId(comment.getId())); for (SessionAnnotationLink sessionAnnotationLink : links) { iUpdate.deleteObject(sessionAnnotationLink); } iUpdate.deleteObject(comment); }
public List<OriginalFile> getMyUserPhotos() { Parameters parameters = new Parameters(); parameters.addId(getEventContext().getCurrentUserId()); parameters.addString("ns", NSEXPERIMENTERPHOTO); List<OriginalFile> photos = iQuery.findAllByQuery( "select f from Experimenter e join e.annotationLinks l " + "join l.child a join a.file f where e.id = :id and a.ns = :ns", parameters); return photos; }
/** * Retrieves all Pixels linked to a given set of Image IDs. * * @param imageIds Image IDs to retrieve Pixels for. * @return List of Pixels associated with the given Image IDs. */ private List<Pixels> loadPixelsByImage(Set<Long> imageIds) { StopWatch s1 = new Slf4JStopWatch("omero.loadPixelsByImage"); Parameters p = new Parameters(); p.addIds(imageIds); String sql = "select pix from Pixels as pix " + "join fetch pix.image as i " + "join fetch pix.pixelsType " + "join fetch pix.channels as c " + "join fetch c.logicalChannel " + "where i.id in (:ids)"; List<Pixels> pixels = iQuery.findAllByQuery(sql, p); s1.stop(); return pixels; }
/** * Retrieves all Pixels associated with the specified <code>Plate</code>s. * * @param plateIds The identifiers of the plate to retrieve Pixels for. * @return List of Pixels associated with the Plate. */ private List<Pixels> loadPlatePixels(Set<Long> plateIds) { StopWatch s1 = new Slf4JStopWatch("omero.loadPlatePixels"); Parameters p = new Parameters(); p.addIds(plateIds); String sql = "select pix from Pixels as pix " + "join fetch pix.image as i " + "join fetch pix.pixelsType " + "join fetch pix.channels as c " + "join fetch c.logicalChannel " + "left outer join i.wellSamples as s " + "left outer join s.well as w " + "left outer join w.plate as p " + "where p.id in (:ids)"; List<Pixels> pixels = iQuery.findAllByQuery(sql, p); s1.stop(); return pixels; }
/** * Retrieves all Pixels by ID. * * @param pixelsIds Pixels IDs to retrieve Pixels for. * @return List of Pixels with the given Pixels IDs. */ private List<Pixels> loadPixels(Set<Long> pixelsIds) { StopWatch s1 = new Slf4JStopWatch("omero.loadPixels"); Parameters p = new Parameters(); p.addIds(pixelsIds); String sql = "select pix from Pixels as pix " + "join fetch pix.image " + "join fetch pix.pixelsType " + "join fetch pix.channels as c " + "join fetch c.logicalChannel " + "where pix.id in (:ids)"; List<Pixels> pixels = iQuery.findAllByQuery(sql, p); s1.stop(); return pixels; }
/** * Retrieves all Pixels associated with the specified <code>Plate</code>s. * * @param ids The identifiers of the plate acquisition to retrieve Pixels for. * @return List of Pixels associated with the Plate. */ private List<Pixels> loadPlateAcquisitionPixels(Set<Long> ids) { StopWatch s1 = new Slf4JStopWatch("omero.loadPlatePixels"); Parameters p = new Parameters(); p.addIds(ids); String sql = "select pix from Pixels as pix " + "join fetch pix.image as i " + "join fetch pix.pixelsType " + "join fetch pix.channels as c " + "join fetch c.logicalChannel " + "left outer join i.wellSamples as s " + "left outer join s.plateAcquisition as p " + "where p.id in (:ids)"; List<Pixels> pixels = iQuery.findAllByQuery(sql, p); s1.stop(); return pixels; }
/** * Retrieves all Pixels associated with the specified <code>Dataset</code>s. * * @param datasetIds Dataset ID to retrieve Pixels for. * @return List of Pixels associated with the Dataset. */ private List<Pixels> loadDatasetPixels(Set<Long> datasetIds) { StopWatch s1 = new Slf4JStopWatch("omero.loadDatasetPixels"); Parameters p = new Parameters(); p.addIds(datasetIds); String sql = "select pix from Pixels as pix " + "join fetch pix.image as i " + "join fetch pix.pixelsType " + "join fetch pix.channels as c " + "join fetch c.logicalChannel " + "left outer join i.datasetLinks dil " + "left outer join dil.parent d " + "where d.id in (:ids)"; List<Pixels> pixels = iQuery.findAllByQuery(sql, p); s1.stop(); return pixels; }
/** * Retrieves all Pixels associated with a Project from the database. * * @param projectIds Project ID to retrieve Pixels for. * @return List of Pixels associated with the Project. */ private List<Pixels> loadProjectPixels(Set<Long> projectIds) { StopWatch s1 = new Slf4JStopWatch("omero.loadProjectPixels"); Parameters p = new Parameters(); p.addIds(projectIds); String sql = "select pix from Pixels as pix " + "join fetch pix.image as i " + "join fetch pix.pixelsType " + "join fetch pix.channels as c " + "join fetch c.logicalChannel " + "left outer join i.datasetLinks dil " + "left outer join dil.parent as d " + "left outer join d.projectLinks as pdl " + "left outer join pdl.parent as p " + "where p.id in (:ids)"; List<Pixels> pixels = iQuery.findAllByQuery(sql, p); s1.stop(); return pixels; }
@RolesAllowed("system") public List<Experimenter> discover() { List<Experimenter> discoveredExperimenters = Lists.newArrayList(); Roles r = getSecuritySystem().getSecurityRoles(); List<Experimenter> localExperimenters = iQuery.findAllByQuery( "select distinct e from Experimenter e " + "where id not in (:ids) and ldap = :ldap", new Parameters() .addIds(Lists.newArrayList(r.getRootId(), r.getGuestId())) .addBoolean("ldap", false)); for (Experimenter e : localExperimenters) { try { findExperimenter(e.getOmeName()); } catch (ApiUsageException aue) { // This user doesn't have an LDAP account continue; } discoveredExperimenters.add(e); } return discoveredExperimenters; }
/** * Retrieves all Pixels associated with the specified <code>Screen</code>. * * @param screenIds The identifiers of the Screen to retrieve Pixels for. * @return List of Pixels associated with the Screen. */ private List<Pixels> loadScreenPixels(Set<Long> screenIds) { StopWatch s1 = new Slf4JStopWatch("omero.loadScreenPixels"); Parameters p = new Parameters(); p.addIds(screenIds); String sql = "select pix from Pixels as pix " + "join fetch pix.image as i " + "join fetch pix.pixelsType " + "join fetch pix.channels as c " + "join fetch c.logicalChannel " + "left outer join i.wellSamples as s " + "left outer join s.well as w " + "left outer join w.plate as p " + "left outer join p.screenLinks as spl " + "left outer join spl.parent as s " + "where s.id in (:ids)"; List<Pixels> pixels = iQuery.findAllByQuery(sql, p); s1.stop(); return pixels; }
@RolesAllowed("system") public List<ExperimenterGroup> discoverGroups() { List<ExperimenterGroup> discoveredGroups = Lists.newArrayList(); Roles r = getSecuritySystem().getSecurityRoles(); List<ExperimenterGroup> localGroups = iQuery.findAllByQuery( "select distinct g from ExperimenterGroup g " + "where id not in (:ids) and ldap = :ldap", new Parameters().addIds( Lists.newArrayList(r.getGuestGroupId(), r.getSystemGroupId(), r.getUserGroupId())) .addBoolean("ldap", false)); for (ExperimenterGroup g : localGroups) { try { findGroup(g.getName()); } catch (ApiUsageException aue) { // This group doesn't exist in the LDAP server continue; } discoveredGroups.add(g); } return discoveredGroups; }