@Override public long save(Box box) throws IOException { box.setChangeDetails(authorizationManager.getCurrentUser()); if (box.getStorageLocation() != null) { box.setStorageLocation(storageLocationService.get(box.getStorageLocation().getId())); addBoxContentsChangeLog(managed, message.toString()); managed.setChangeDetails(authorizationManager.getCurrentUser()); return boxStore.save(managed);
addBoxContentsChangeLog(managedOriginal.getBox(), String.format("Removed %s (%s)", managedOriginal.getAlias(), managedOriginal.getName())); box.setChangeDetails(authorizationManager.getCurrentUser()); boxStore.save(box); managedNew.getBoxPositions().put(boxable.getBoxPosition(), new BoxPosition(managedNew, boxable.getBoxPosition(), boxable.getEntityType(), boxable.getId())); managedNew.setChangeDetails(authorizationManager.getCurrentUser()); boxStore.save(managedNew);
private long saveNewBox(Box box) throws IOException { authorizationManager.throwIfNotWritable(box); try { box.setName(generateTemporaryName()); box.setSecurityProfile(securityProfileStore.get(securityProfileStore.save(box.getSecurityProfile()))); box.setChangeDetails(authorizationManager.getCurrentUser()); box.setIdentificationBarcode(LimsUtils.nullifyStringIfBlank(box.getIdentificationBarcode())); validateChange(box, null); boxStore.save(box); if (autoGenerateIdBarcodes) { box.setIdentificationBarcode(box.getName() + "::" + box.getAlias()); } box.setName(namingScheme.generateNameFor(box)); validateNameOrThrow(box, namingScheme); if (box.getStorageLocation() != null) { addStorageChangeLog(getFreezer(box), box, true); } return boxStore.save(box); } catch (MisoNamingException e) { throw new IOException("Invalid name for box", e); } }