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; }
/** * Copies modifiable fields from the source LibraryDilution into the target LibraryDilution to be persisted * * @param target the persisted LibraryDilution to modify * @param source the modified LibraryDilution to copy modifiable fields from * @throws IOException */ private void applyChanges(LibraryDilution target, LibraryDilution source) { target.setTargetedSequencing(source.getTargetedSequencing()); target.setIdentificationBarcode(LimsUtils.nullifyStringIfBlank(source.getIdentificationBarcode())); target.setVolume(source.getVolume()); target.setVolumeUnits(target.getVolume() == null ? null : source.getVolumeUnits()); target.setConcentration(source.getConcentration()); target.setConcentrationUnits(target.getConcentration() == null ? null : source.getConcentrationUnits()); target.setNgUsed(source.getNgUsed()); target.setVolumeUsed(source.getVolumeUsed()); }