@Override public long save(Submission submission) throws IOException { if (submission.getId() == Submission.UNSAVED_ID) { submission.setExperiments(submission.getExperiments().stream().map(Experiment::getId) .map(WhineyFunction.rethrow(experimentService::get)) .collect(Collectors.toSet())); return submissionStore.save(submission); } else { Submission managed = submissionStore.get(submission.getId()); managed.setAccession(submission.getAccession()); managed.setAlias(submission.getAlias()); managed.setCompleted(submission.isCompleted()); managed.setDescription(submission.getDescription()); managed.setSubmissionDate(submission.getSubmissionDate()); managed.setTitle(submission.getTitle()); managed.setVerified(submission.isVerified()); return submissionStore.save(submission); } }
public String fileName() { return String.format("%s_%s_%s.xml", submission.getAlias(), name(), DF_TIMESTAMP.format(submission.getSubmissionDate())); }
public static SubmissionDto asDto(@Nonnull Submission from) { SubmissionDto dto = new SubmissionDto(); dto.setId(from.getId()); dto.setAccession(from.getAccession()); dto.setAlias(from.getAlias()); dto.setCompleted(from.isCompleted()); dto.setCreationDate(formatDate(from.getCreationDate())); dto.setDescription(from.getDescription()); dto.setSubmittedDate(formatDate(from.getSubmissionDate())); dto.setTitle(from.getTitle()); dto.setVerified(from.isVerified()); return dto; }
submission.setSubmissionDate(new Date()); s.setAttribute("alias", submission.getAlias()); s.setAttribute("submission_date", DF_TIMESTAMP.format(submission.getSubmissionDate())); s.setAttribute("submission_comment", submission.getDescription()); s.setAttribute("center_name", centreName); title.setTextContent(submission.getTitle()); s.appendChild(title); Stream .concat(Stream.of(user), submission.getExperiments().stream().map(experiment -> experiment.getSecurityProfile().getOwner()).filter(Objects::nonNull)) .map(User::getFullName).distinct() .map(contactName -> {
@Override protected Stream<Experiment> items() { return submission.getExperiments().stream(); }
@Override public Stream<Study> items() { return submission.getExperiments().stream().map(Experiment::getStudy).distinct(); }
@Override protected Stream<Sample> items() { return submission.getExperiments().stream().map(Experiment::getLibrary).map(Library::getSample).distinct(); }
@Override protected Stream<Pair<PoolableElementView, Partition>> items() { return submission.getExperiments().stream().flatMap(experiment -> experiment.getRunPartitions().stream()).flatMap( rp -> rp.getPartition().getPool().getPoolDilutions().stream() .map(pd -> new Pair<>(pd.getPoolableElementView(), rp.getPartition()))); }
@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()); } }