@Override public void beforeDelete(LibraryDilution object) throws IOException { List<Workset> worksets = worksetService.listByDilution(object.getId()); for (Workset workset : worksets) { workset.getDilutions().removeIf(ldi -> ldi.getId() == object.getId()); worksetService.save(workset); } Box box = object.getBox(); if (box != null) { box.getBoxPositions().remove(object.getBoxPosition()); boxService.save(box); } }
v.setLastModified(dilution.getLastModified()); v.setPreMigrationId(dilution.getPreMigrationId()); if (dilution.getBox() != null) { v.setBoxName(dilution.getBox().getName()); v.setBoxAlias(dilution.getBox().getAlias()); v.setBoxIdentificationBarcode(dilution.getBox().getIdentificationBarcode()); v.setBoxLocationBarcode(dilution.getBox().getLocationBarcode());
private static DilutionDto asDto(@Nonnull LibraryDilution from, @Nonnull LibraryDto libraryDto, boolean includeBoxPositions) { DilutionDto dto = new DilutionDto(); dto.setId(from.getId()); dto.setName(from.getName()); dto.setDilutionUserName(from.getCreator().getFullName()); dto.setConcentration(from.getConcentration() == null ? null : from.getConcentration().toString()); dto.setConcentrationUnits(from.getConcentrationUnits()); dto.setVolume(from.getVolume() == null ? null : from.getVolume().toString()); dto.setVolumeUnits(from.getVolumeUnits()); dto.setNgUsed(from.getNgUsed() == null ? null : from.getNgUsed().toString()); dto.setVolumeUsed(from.getVolumeUsed() == null ? null : from.getVolumeUsed().toString()); if (from.getCreationDate() != null) { dto.setCreationDate(formatDate(from.getCreationDate())); } dto.setIdentificationBarcode(from.getIdentificationBarcode()); dto.setLocationLabel(BoxUtils.makeLocationLabel(from)); if (from.getTargetedSequencing() != null) { dto.setTargetedSequencingId(from.getTargetedSequencing().getId()); } dto.setLibrary(libraryDto); if (from.getBox() != null) { dto.setBox(asDto(from.getBox(), includeBoxPositions)); dto.setBoxPosition(from.getBoxPosition()); } dto.setDiscarded(from.isDiscarded()); return dto; }