if (run1.getCompletionDate() == null) { if (run2.getCompletionDate() == null) { return run1; } else if (run2.getCompletionDate() == null) { return run2; if (run1.getCompletionDate().before(run2.getCompletionDate())) { return run2; } else if (run1.getCompletionDate().after(run2.getCompletionDate())) { return run1;
@Override protected void populate(Element xml, Pair<PoolableElementView, Partition> entry) { Run r = entry.getValue().getSequencerPartitionContainer().getLastRun(); xml.setAttribute("alias", "L00" + entry.getValue().getPartitionNumber() + ":" + entry.getKey().getDilutionName() + ":" + r.getAlias()); xml.setAttribute("run_center", centreName); if (r.getHealth() == HealthType.Completed) { xml.setAttribute("run_date", DF_TIMESTAMP.format(r.getCompletionDate())); } xml.setAttribute("center_name", centreName); for (Experiment e : submission.getExperiments()) { Element experimentRef = xml.getOwnerDocument().createElementNS(null, "EXPERIMENT_REF"); experimentRef.setAttribute("refname", e.getAlias()); experimentRef.setAttribute("refcenter", centreName); xml.appendChild(experimentRef); } Element dataBlock = xml.getOwnerDocument().createElementNS(null, "DATA_BLOCK"); dataBlock.setAttribute("sector", Integer.toString(entry.getValue().getPartitionNumber())); if (entry.getValue().getPool().getPoolDilutions().size() > 1) { // multiplexed dataBlock.setAttribute("member_name", entry.getKey().getDilutionName()); } }
private void validateChanges(Run before, Run changed) throws IOException { List<ValidationError> errors = new ArrayList<>(); if (!changed.getHealth().isDone()) { changed.setCompletionDate(null); } else if (changed.getCompletionDate() == null) { errors.add(new ValidationError("completionDate", "Completion date must be provided for finished run")); } if (before != null) { if (before.getCompletionDate() != null && changed.getCompletionDate() != null && !changed.getCompletionDate().equals(before.getCompletionDate()) && !authorizationManager.isAdminUser()) { errors.add(new ValidationError("completionDate", "Only admin may change completion date")); } if (before.getStartDate() != null && changed.getStartDate() != null && !changed.getStartDate().equals(before.getStartDate()) && !authorizationManager.isAdminUser()) { errors.add(new ValidationError("completionDate", "Only admin may change start date")); } } InstrumentModel platform = changed.getSequencer().getInstrumentModel(); for (RunPosition position : changed.getRunPositions()) { if (position.getPosition() != null && !platform.getPositions().contains(position.getPosition())) { errors.add(new ValidationError( String.format("Platform %s does not have a position %s", platform.getAlias(), position.getPosition()))); } } if (!errors.isEmpty()) { throw new ValidationException(errors); } }
managed.setCompletionDate(notification.getHealth().isDone() ? notification.getCompletionDate() : null); return true; if (notification.getCompletionDate() != null) { completionDate = notification.getCompletionDate(); } else if (managed.getCompletionDate() != null) { completionDate = managed.getCompletionDate(); } else { completionDate = new Date();
dto.setStartDate(""); if (from.getCompletionDate() != null) { dto.setEndDate(formatDate(from.getCompletionDate()));
private void applyChanges(Run target, Run source) throws IOException { validateChanges(target, source); target.setAlias(source.getAlias()); target.setAccession(source.getAccession()); target.setDescription(source.getDescription()); target.setFilePath(source.getFilePath()); target.setHealth(source.getHealth()); target.setStartDate(source.getStartDate()); target.setCompletionDate(source.getCompletionDate()); target.setMetrics(source.getMetrics()); makeContainerChangesChangeLog(target, target.getSequencerPartitionContainers(), source.getSequencerPartitionContainers()); applyContainerChanges(target, source); target.setSequencingParameters(source.getSequencingParameters()); target.setSequencer(source.getSequencer()); if (isIlluminaRun(target)) { applyIlluminaChanges((IlluminaRun) target, (IlluminaRun) source); } else if (isLS454Run(target)) { applyLS454Changes((LS454Run) target, (LS454Run) source); } else if (isSolidRun(target)) { applySolidChanges((SolidRun) target, (SolidRun) source); } else if (isOxfordNanoporeRun(target)) { applyOxfordNanoporeChanges((OxfordNanoporeRun) target, (OxfordNanoporeRun) source); } }