public static Workset to(@Nonnull WorksetDto from) { Workset workset = new Workset(); if (from.getId() != null) { workset.setId(from.getId()); } workset.setAlias(from.getAlias()); workset.setDescription(from.getDescription()); if (from.getSampleIds() != null && !from.getSampleIds().isEmpty()) { workset.setSamples(from.getSampleIds().stream().map(id -> { Sample s = new SampleImpl(); s.setId(id); return s; }).collect(Collectors.toSet())); } if (from.getLibraryIds() != null && !from.getLibraryIds().isEmpty()) { workset.setLibraries(from.getLibraryIds().stream().map(id -> { Library l = new LibraryImpl(); l.setId(id); return l; }).collect(Collectors.toSet())); } if (from.getDilutionIds() != null && !from.getDilutionIds().isEmpty()) { workset.setDilutions(from.getDilutionIds().stream().map(id -> { LibraryDilution d = new LibraryDilution(); d.setId(id); return d; }).collect(Collectors.toSet())); } return workset; }
public static LibraryDilution to(@Nonnull DilutionDto from) { LibraryDilution to = new LibraryDilution(); if (from.getId() != null) to.setId(from.getId()); if (!isStringEmptyOrNull(from.getName())) { to.setName(from.getName()); } to.setIdentificationBarcode(from.getIdentificationBarcode()); to.setConcentration(from.getConcentration() == null ? null : Double.valueOf(from.getConcentration())); to.setConcentrationUnits(from.getConcentrationUnits()); to.setNgUsed(from.getNgUsed() == null ? null : Double.valueOf(from.getNgUsed())); to.setVolume(from.getVolume() == null ? null : Double.valueOf(from.getVolume())); to.setVolumeUnits(from.getVolumeUnits()); to.setVolumeUsed(from.getVolumeUsed() == null ? null : Double.valueOf(from.getVolumeUsed())); to.setLibrary(to(from.getLibrary())); to.setCreationDate(parseDate(from.getCreationDate())); if (from.getTargetedSequencingId() != null) { to.setTargetedSequencing(new TargetedSequencing()); to.getTargetedSequencing().setId(from.getTargetedSequencingId()); } to.setBoxPosition((DilutionBoxPosition) makeBoxablePosition(from, to)); to.setDiscarded(from.isDiscarded()); return to; }