protected void checkProperty(String type, String property) { if (!property.matches(alphaNumeric)) { throw new ApiUsageException("Property argument to " + "getCollectionCount may ONLY be alpha-numeric (" + alphaNumeric + ")"); } if (!iQuery.checkProperty(type, property)) { throw new ApiUsageException(type + "." + property + " is an unknown property on type " + type); } }
protected void checkType(String type) { if (!type.matches(alphaNumericDotted)) { throw new ApiUsageException( "Type argument to getCollectionCount may ONLY be " + "alpha-numeric with dots (" + alphaNumericDotted + ")"); } if (!iQuery.checkType(type)) { throw new ApiUsageException(type + " is an unknown type."); } }
@RolesAllowed("user") public byte[] getThumbnailDirect(Integer sizeX, Integer sizeY) { // Leaving rewriteMetadata here true since it's unclear of what the // expected state of the bean should be. byte[] value = retrieveThumbnailDirect(sizeX, sizeY, null, null, true); // Ensure that we do not have "dirty" pixels or rendering settings // left around in the Hibernate session cache. iQuery.clear(); return value; }
@Override public Session findSessionById(long id, ServiceFactory sf) { final LocalQuery iQuery = (LocalQuery) sf.getQueryService(); final String sessionClass = iQuery.find(Share.class, id) == null ? "Session" : "Share"; return (Session) iQuery.findByQuery( "select s from " + sessionClass + " s " + "left outer join fetch s.sudoer " + "left outer join fetch s.annotationLinks l " + "left outer join fetch l.child a where s.id = :id", new Parameters().addId(id).cache()); }
@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); }
public void runAsAdmin() { iQuery.execute(new HibernateCallback<Object>() { public Object doInHibernate(org.hibernate.Session s) throws HibernateException, SQLException { Query q = qb.query(s); List<Object[]> results = q.list(); if (results.size() != shareIds.size()) { throw new ValidationException( "Missing or protected shares specified"); } for (Object[] values : results) { Long shareId = (Long) values[0]; Long count = (Long) values[1]; rv.put(shareId, count); } return null; }}); }}); return rv;
@RolesAllowed("user") public Pixels retrievePixDescription(long pixId) { Pixels p = iQuery.findByQuery("select p from Pixels as p " + "left outer join fetch p.pixelsType as pt " + "left outer join fetch p.channels as c " + "left outer join fetch c.logicalChannel as lc " + "left outer join fetch c.statsInfo " + "left outer join fetch lc.photometricInterpretation " + "left outer join fetch lc.illumination " + "left outer join fetch lc.mode " + "left outer join fetch lc.contrastMethod " + "where p.id = :id", new Parameters().addId(pixId)); return p; }
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>(); fa = (FileAnnotation) object; if (fa.getFile() != null) { of = iQuery.findByQuery(LOAD_ORIGINAL_FILE, new Parameters().addId(fa.getFile().getId())); fa.setFile((OriginalFile) of);
.addSet("annotatorIds", annotatorIds)); List<IAnnotated> l = iQuery.execute(q); iQuery.clear(); fa = (FileAnnotation) object; if (fa.getFile() != null) { of = iQuery.findByQuery(LOAD_ORIGINAL_FILE, new Parameters().addId(fa.getFile().getId())); fa.setFile(of);
PojosLoadHierarchyQueryDefinition.class.getName(), options.addClass(rootNodeType).addIds(rootNodeIds)); List<IObject> l = iQuery.execute(q); PojosLoadHierarchyQueryDefinition.class.getName(), options.addClass(Dataset.class).addIds(rootNodeIds)); List<IObject> list = iQuery.execute(q); Iterator<IObject> j = list.iterator(); Long id; nl.addAll(notLinked.values()); List<IObject> projects = iQuery.findAllByQuery(sb.toString(), new Parameters().addList("list", nl)); if (projects.isEmpty()) { iQuery.findAllByQuery(loadCountsDatasets, new Parameters() .addSet("list", datasets)); iQuery.findAllByQuery(loadCountsImages, new Parameters() .addSet("list", images)); PojosLoadHierarchyQueryDefinition.class.getName(), options.addClass(Plate.class).addIds(rootNodeIds)); List<IObject> list = iQuery.execute(q); Iterator<IObject> j = list.iterator(); Long id; nl.addAll(notLinked.values());
@RolesAllowed("user") @Transactional(readOnly = false) public void setDescription(long shareId, String description) { Share share = (Share) iQuery.find(Share.class, shareId); ShareData data = store.get(shareId); share.setMessage(description); storeShareData(shareId, data); }
@RolesAllowed("user") @Deprecated public <T extends IObject> List<T> getAllEnumerations(Class<T> klass) { return iQuery.findAll(klass, null); }
public E call(IObject object) { iQuery.evict(object); return (E) object; }; }
if (obj.getId() != null && !query.contains(obj)) { throw new SecurityViolation("Services are not allowed to call " + "doAction() on non-Session-managed entities.");
@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); }
@SuppressWarnings("rawtypes") private List getGroupField(final Experimenter e, final String name) { Assert.notNull(e); Assert.notNull(e.getId()); List<String> groupNames = iQuery.execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { org.hibernate.Query q = session .createQuery("select m.parent." + name + " " + "from Experimenter e " + "join e.groupExperimenterMap m " + "where e.id = :id order by index(m)"); q.setParameter("id", e.getId()); return q.list(); } }); return groupNames; }
@Override @RolesAllowed("user") public RenderingDef loadRndSettings(long renderingDefId) { return (RenderingDef) iQuery.findByQuery( RENDERING_DEF_QUERY_PREFIX + "rdef.id = :id", new Parameters().addId(renderingDefId)); }
Instrument value = iQuery.findByQuery(sb.toString(), params); if (value == null) return null; if (builder != null) { list.addAll( iQuery.findAllByQuery(builder.toString(), params));
@RolesAllowed("user") @Transactional(readOnly = false) public void setExpiration(long shareId, Timestamp expiration) { Share share = (Share) iQuery.find(Share.class, shareId); ShareData data = store.get(shareId); share.setTimeToLive(expirationAsLong(share.getStarted().getTime(), expiration)); storeShareData(shareId, data); }