예제 #1
0
  private boolean parseAcceptsList(final QueryBuilder qb, final List<IObject> acceptsList) {
    qb.where();
    scripts.buildQuery(qb);

    if (acceptsList != null && acceptsList.size() > 0) {
      for (IObject object : acceptsList) {
        if (object instanceof Experimenter) {
          qb.and("o.details.owner.id = :oid");
          qb.param("oid", object.getId().getValue());
        } else if (object instanceof ExperimenterGroup) {
          qb.and("o.details.group.id = :gid");
          qb.param("gid", object.getId().getValue());
        } else {
          throw new ome.conditions.ValidationException("Unsupported accept-type: " + object);
        }
      }
      return true;
    }
    return false;
  }
예제 #2
0
 protected Long loadLogFile() throws ServerError {
   final ImportRequest req = (ImportRequest) handle.getRequest();
   final Long fsId = req.activity.getParent().getId().getValue();
   final IMetadataPrx metadataService = sf.getMetadataService();
   final List<Long> rootIds = Collections.singletonList(fsId);
   try {
     final Map<Long, List<IObject>> logMap =
         metadataService.loadLogFiles(Fileset.class.getName(), rootIds);
     final List<IObject> logs = logMap.get(fsId);
     if (CollectionUtils.isNotEmpty(logs)) {
       for (final IObject log : logs) {
         if (log instanceof OriginalFile) {
           final Long ofId = log.getId().getValue();
           if (ofId != null) {
             return ofId;
           }
         }
       }
     }
   } catch (ServerError e) {
     log.debug("failed to load log file", e);
   }
   return null;
 }
예제 #3
0
 /**
  * For a given IAnnotated type
  *
  * @param o
  * @param a
  */
 public IObject createAnnotationLink(IObject o, Annotation a) throws Exception {
   String name;
   if (o instanceof Annotation) {
     name = "omero.model.AnnotationAnnotationLinkI";
   } else {
     name = o.getClass().getSimpleName();
     name = name.substring(0, name.length() - 1);
     name = "omero.model." + name + "AnnotationLinkI";
   }
   Class<?> linkClass = Class.forName(name);
   IObject link = (IObject) linkClass.newInstance();
   Method linkMethod = null;
   for (Method m : linkClass.getMethods()) {
     if ("link".equals(m.getName())) {
       linkMethod = m;
       break;
     }
   }
   linkMethod.invoke(link, o, a, null); // Last is Ice.Current;
   return link;
 }