/**
  * Loads the thumbnails for the passed collection of files.
  *
  * @param files The collection of files to handle.
  */
 private void loadFSThumbnails(List files) {
   List result = new ArrayList();
   try {
     ExperimenterData exp = (ExperimenterData) context.lookup(LookupNames.CURRENT_USER_DETAILS);
     long id = exp.getId();
     Map<DataObject, BufferedImage> m = service.getFSThumbnailSet(ctx, files, maxLength, id);
     Entry<DataObject, BufferedImage> entry;
     Iterator<Entry<DataObject, BufferedImage>> i = m.entrySet().iterator();
     BufferedImage thumb;
     DataObject obj;
     boolean valid = true;
     FileData f;
     while (i.hasNext()) {
       entry = i.next();
       obj = entry.getKey();
       thumb = entry.getValue();
       if (thumb == null) {
         thumb = Factory.createDefaultImageThumbnail(Factory.IMAGE_ICON);
       }
       if (obj.getId() > 0) result.add(new ThumbnailData(obj.getId(), thumb, valid));
       else result.add(new ThumbnailData(obj, thumb, valid));
     }
     currentThumbs = result;
   } catch (Exception e) {
     currentThumbs = result;
     context.getLogger().error(this, "Cannot retrieve thumbnail: " + e.getMessage());
   }
 }
Example #2
0
 /** Converts the parameters. */
 private void convertJobParameters() {
   if (parameters == null) return;
   // Convert authors if
   String[] authors = parameters.authors;
   if (authors != null && authors.length > 0) {
     ExperimenterData exp;
     for (int i = 0; i < authors.length; i++) {
       exp = new ExperimenterData();
       exp.setLastName(authors[i]);
     }
   }
   Map<String, Param> map = parameters.inputs;
   Entry<String, Param> entry;
   Iterator<Entry<String, Param>> i;
   Param p;
   inputs = new HashMap<String, ParamData>();
   if (map != null) {
     i = map.entrySet().iterator();
     String key;
     ParamData param;
     while (i.hasNext()) {
       entry = i.next();
       p = entry.getValue();
       key = entry.getKey();
       param = new ParamData(p);
       inputs.put(key, param);
       if (DATA_TYPE.equals(key)) {
         populateDataTypes(param.getValues());
       }
     }
   }
   map = parameters.outputs;
   outputs = new HashMap<String, ParamData>();
   if (map != null) {
     i = map.entrySet().iterator();
     while (i.hasNext()) {
       entry = i.next();
       p = entry.getValue();
       outputs.put(entry.getKey(), new ParamData(p));
     }
   }
 }
Example #3
0
 /**
  * Returns the list of users who annotated that image only if the annotation cannot be unlinked.
  *
  * @param object The object the annotation is linked to.
  * @param annotation The annotation to handle.
  */
 private String formatAnnotators(DataObject object, AnnotationData annotation) {
   StringBuffer buffer = new StringBuffer();
   List<ExperimenterData> annotators = model.getAnnotators(object, annotation);
   if (annotators.size() == 0) return null;
   long userID = model.getCurrentUser().getId();
   Iterator<ExperimenterData> i = annotators.iterator();
   ExperimenterData annotator;
   int n = annotators.size() - 1;
   int index = 0;
   buffer.append(" (");
   while (i.hasNext()) {
     annotator = i.next();
     if (annotator.getId() != userID) {
       buffer.append(EditorUtil.formatExperimenter(annotator));
       if (index != n) buffer.append(", ");
       index++;
     }
   }
   if (index == 0) return null;
   buffer.append(")");
   return buffer.toString();
 }
 /**
  * Returns the id of the experimenter.
  *
  * @return See above.
  */
 public long getExperimenter() {
   if (experimenter == null) return -1;
   return experimenter.getId();
 }