Example #1
0
 public void addWatcher(Run run, Long userId) throws IOException {
   User user = securityManager.getUserById(userId);
   if (user != null) {
     Run clone = runs.get(run.getId());
     if (clone == null) {
       run.addWatcher(user);
       push(run);
     } else {
       clone.addWatcher(user);
     }
   }
 }
Example #2
0
  private void update(Run r) throws IOException {
    if (enabled) {
      Run clone = runs.get(r.getId());
      if (clone == null) {
        log.debug("Update: no clone - pushing");
        // new run - add all RunWatchers!
        for (User u : securityManager.listUsersByGroupName("RunWatchers")) {
          r.addWatcher(u);
        }
        push(r);
      } else {
        log.debug("Update: got clone of " + clone.getId());
        if (r.getStatus() != null) {
          clone.setStatus(r.getStatus());
        }

        // run QC added
        if (r.getRunQCs().size() > clone.getRunQCs().size()) {
          Set<RunQC> clonedQCs = new HashSet<RunQC>(clone.getRunQCs());
          for (RunQC qc : r.getRunQCs()) {
            if (!clonedQCs.contains(qc)) {
              try {
                clone.addQc(cloner.deepClone(qc));
              } catch (MalformedRunQcException e) {
                throw new IOException(e);
              }
            }
          }
        }

        pop(clone);
        push(r);
      }
    }
  }