@Transactional(readOnly = true) public Object doWork(org.hibernate.Session session, ServiceFactory sf) { return sf.getQueryService().projection(projection, parameters); } });
@Transactional public Object doWork(Session session, ServiceFactory sf) { final IQuery iQuery = sf.getQueryService(); final ome.model.core.OriginalFile originalFile = iQuery.find(ome.model.core.OriginalFile.class, id); final ome.model.enums.ChecksumAlgorithm sha1 = iQuery.findByString(ome.model.enums.ChecksumAlgorithm.class, "value", ChecksumAlgorithmSHA1160.value); originalFile.setHash(null); originalFile.setHasher(sha1); sf.getUpdateService().saveObject(originalFile); return null; } });
@Transactional(readOnly = true) public List<IObject> doWork(Session session, ServiceFactory sf) { return sf.getQueryService().findAllByQuery( query, params ); } });
@Transactional(readOnly = true) public Object doWork(Session session, ServiceFactory sf) { return sf.getQueryService().findByQuery( "select o from OriginalFile o " + "where o.id = " + id, null); } });
@Transactional(readOnly = true) public Object doWork(Session session, ServiceFactory sf) { return (T) sf.getQueryService() .get(argument.getClass(), argument.getId().longValue()); }}); }
id = q.findByString(ome.model.core.OriginalFile.class, "hash", repoUuid).getId(); q.get(ome.model.core.OriginalFile.class, id); for (final List<Long> idsBatch : Iterables.partition(ids, BATCH_SIZE)) { final Parameters params = new Parameters().addIds(idsBatch); for (final IObject file : q.findAllByQuery(filesById, params)) { files.add((ome.model.core.OriginalFile) file);
@Transactional(readOnly = true) public Object doWork(Session session, ServiceFactory sf) { final Long sessionId = sessionProvider.findSessionIdByUuid(userId, sf); final ome.model.meta.Session s = sessionId == null ? null : sessionProvider.findSessionById(sessionId, sf); IQuery q = sf.getQueryService(); Experimenter e = null; if (s != null) { e = s.getOwner(); if (!e.isLoaded()) { e = q.get(Experimenter.class, e.getId()); } data.add(String.format("user=%s", e.getOmeName())); } else { e = q.findByString(Experimenter.class, "omeName", userId); if (e != null) { data.add(String.format("id=%s", e.getId())); } } if (s != null) { data.add(String.format("created=%s", s.getStarted())); data.add(String.format("closed=%s", s.getClosed())); } return null; } });
/** * Use {@link PixelsService} to find pre-FS binary files under * "/OMERO/Files", "/OMERO/Pixels", and "/OMERO/Thumbnails", * and store their size in the response. */ private void findBinary() { IQuery query = helper.getServiceFactory().getQueryService(); Pixels pixels = query.get(Image.class, imageId).getPrimaryPixels(); List<Thumbnail> thumbs = query.findAllByQuery( "select tb from Thumbnail tb where " + "tb.pixels.id = :id", new Parameters().addId(pixels.getId())); String path = pixelsService.getPixelsPath(pixels.getId()); files = new PixelFiles(path); files.update(rsp); for (Thumbnail tb: thumbs) { path = pixelsService.getThumbnailPath(tb.getId()); File thumbnailFile = new File(path); thumbnailFiles.add(thumbnailFile); rsp.thumbnailSize += thumbnailFile.length(); } }
protected String getUserEmail(String user) { Experimenter e = getQueryService().findByString(Experimenter.class, "omeName", user); if (e == null) { return null; } return e.getEmail(); }
public Job lookup(long id) { return query.find(Job.class, id); }
@Transactional(readOnly = true) public Object doWork(Session session, ServiceFactory sf) { List<Node> nodes = sf.getQueryService().findAll( Node.class, null); Set<String> nodeIds = new HashSet<String>(); for (Node node : nodes) { if (onlyActive && node.getDown() != null) { continue; // Remove none active managers } nodeIds.add(node.getUuid()); } return nodeIds; } });
public final EventLog lastEventLog() { return queryService.findByQuery( "select el from EventLog el order by id desc", new Parameters().page(0, 1)); }
private boolean requiresPyramid(ServiceFactory sf, long id) { ome.model.core.Pixels _p = sf.getQueryService().get(ome.model.core.Pixels.class, id); return pixelsService.requiresPixelsPyramid(_p); }
@Override public Long findSessionIdByUuid(final String uuid, ServiceFactory sf) { final Session session = sf.getQueryService().findByString(Session.class, "uuid", uuid); return session == null ? null : session.getId(); }
protected Job job(ServiceFactory sf, long id) { Job job = sf.getQueryService().find(Job.class, id); return job; }
/** * Called when the configuration database does not contain a valid * current_id. Used to index all the data which does not have an EventLog. */ @Override public void initialize() { for (Class<IEnum> cls : types.getEnumerationTypes()) { for (IEnum e : queryService.findAll(cls, null)) { addEventLog(cls, e.getId()); } } }
/** * Perform the database query to discover the IDs of the related objects. * @param toType the type of the objects to which the query object may be related, not <code>null</code> * @param fromType the query object's type, not <code>null</code> * @param fromIds the query objects' database IDs, none <code>null</code> * @return pairs of database IDs: of the query object, and an object to which it relates */ private List<Object[]> doQuery(String toType, String fromType, Collection<Long> fromIds) { final String queryString = hqlFromTo.get(Maps.immutableEntry(fromType, toType)); if (queryString == null) { throw new IllegalArgumentException("not implemented for " + fromType + " to " + toType); } return this.iQuery.projection(queryString, new Parameters().addIds(fromIds)); }
@Transactional(readOnly = true) public Object doWork(Session session, ServiceFactory sf) { return sf.getQueryService().findAllByQuery( QUERY, null); } }));
public Pixels getPixels() { return sf.getQueryService().findByQuery("select p from Dataset d " + "join d.imageLinks dil " + "join dil.child img " + "join img.pixels p where d.id = "+d.getId(), null); } }
@Transactional(readOnly = true) public Object doWork(Session session, ServiceFactory sf) { return sf.getQueryService().get( ome.model.core.OriginalFile.class, file.getId().getValue()); } });