@Override @CoverageIgnore public int hashCode() { if (getId() != UNSAVED_ID) { return (int) getId(); } else { final int PRIME = 37; int hashcode = 1; if (getName() != null) hashcode = PRIME * hashcode + getName().hashCode(); if (getAlias() != null) hashcode = 37 * hashcode + getAlias().hashCode(); return hashcode; } }
@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()); } }
/** * Equivalency is based on getId() if set, otherwise on name, description and creation date. */ @Override @CoverageIgnore public boolean equals(Object obj) { if (obj == null) return false; if (obj == this) return true; if (!(obj instanceof Experiment)) return false; final Experiment them = (Experiment) obj; // If not saved, then compare resolved actual objects. Otherwise // just compare IDs. if (getId() == UNSAVED_ID || them.getId() == UNSAVED_ID) { if (getName() != null && them.getName() != null) { return getName().equals(them.getName()); } else { return getAlias().equals(them.getAlias()); } } else { return getId() == them.getId(); } }
@Override protected void populate(Element xml, Experiment experiment) { xml.setAttribute("alias", experiment.getAlias()); xml.setAttribute("center_name", centreName);
public static ExperimentDto asDto(@Nonnull Experiment from) { ExperimentDto dto = new ExperimentDto(); dto.setId(from.getId()); dto.setAccession(from.getAccession()); dto.setAlias(from.getAlias()); dto.setDescription(from.getDescription()); dto.setName(from.getName()); dto.setInstrumentModel(asDto(from.getInstrumentModel())); dto.setLibrary(asDto(from.getLibrary(), false)); dto.setPartitions(from.getRunPartitions().stream() .map(entry -> new ExperimentDto.RunPartitionDto(asDto(entry.getRun()), asDto(entry.getPartition()))).collect(Collectors.toList())); dto.setStudy(asDto(from.getStudy())); dto.setTitle(from.getTitle()); return dto; }
authorizationManager.throwIfNotWritable(original); original.setAccession(experiment.getAccession()); original.setAlias(experiment.getAlias()); original.setDescription(experiment.getDescription()); original.setName(experiment.getName());