@Override public SecurityProfile getDeletionSecurityProfile() { return getSecurityProfile(); }
/** * Loads persisted objects into LibraryDilution fields. Should be called before saving LibraryDilutions. Loads all member objects * <b>except</b> * <ul> * <li>creator/lastModifier User objects</li> * </ul> * * @param libraryDilution the LibraryDilution to load entities into. Must contain at least the IDs of objects to load (e.g. to load the * persisted Library * into dilution.library, dilution.library.id must be set) * @throws IOException */ private void loadChildEntities(LibraryDilution dilution) throws IOException { if (dilution.getLibrary() != null) { dilution.setLibrary(libraryService.get(dilution.getLibrary().getId())); } if (dilution.getTargetedSequencing() != null) { dilution.setTargetedSequencing(targetedSequencingService.get(dilution.getTargetedSequencing().getId())); } if (dilution.getSecurityProfile() != null && dilution.getSecurityProfile().getProfileId() != SecurityProfile.UNSAVED_ID) { dilution.setSecurityProfile(securityProfileStore.get(dilution.getSecurityProfile().getProfileId())); } }
@Override public Long create(LibraryDilution dilution) throws IOException { loadChildEntities(dilution); dilution.setCreator(authorizationManager.getCurrentUser()); if (dilution.getSecurityProfile() == null) { dilution.inheritPermissions(libraryService.get(dilution.getLibrary().getId())); } authorizationManager.throwIfNotWritable(dilution); boxService.throwIfBoxPositionIsFilled(dilution); if (dilution.getConcentration() == null) { dilution.setConcentrationUnits(null); } if (dilution.getVolume() == null) { dilution.setVolumeUnits(null); } Library library = dilution.getLibrary(); if (dilution.getVolumeUsed() != null && library.getVolume() != null) { library.setVolume(library.getVolume() - dilution.getVolumeUsed()); } dilution.setChangeDetails(authorizationManager.getCurrentUser()); // pre-save field generation dilution.setName(generateTemporaryName()); validateChange(dilution, null); long savedId = save(dilution).getId(); libraryService.update(library); boxService.updateBoxableLocation(dilution); return savedId; }