public void updateDIPPermissions(DIP dip) throws GenericException, NotFoundException, RequestNotValidException, AuthorizationDeniedException { RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType); dip.setLastModified(new Date()); updateDIPMetadata(dip); notifyDipPermissionsUpdated(dip).failOnError(); }
public DIP updateDIP(DIP dip) throws GenericException, NotFoundException, AuthorizationDeniedException { RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType); try { dip.setLastModified(new Date()); updateDIPMetadata(dip, DefaultStoragePath.parse(RodaConstants.STORAGE_CONTAINER_DIP, dip.getId())); } catch (GenericException | RequestNotValidException e) { LOGGER.error("Error updating DIP in storage", e); throw new GenericException(e); } notifyDIPUpdated(dip, false).failOnError(); return dip; }
public DIP createDIP(DIP dip, boolean notify) throws GenericException, AuthorizationDeniedException { RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType); try { Directory directory; if (StringUtils.isNotBlank(dip.getId())) { try { directory = storage .createDirectory(DefaultStoragePath.parse(RodaConstants.STORAGE_CONTAINER_DIP, dip.getId())); } catch (AlreadyExistsException | GenericException | AuthorizationDeniedException e) { directory = storage.createRandomDirectory(DefaultStoragePath.parse(RodaConstants.STORAGE_CONTAINER_DIP)); dip.setId(directory.getStoragePath().getName()); } } else { directory = storage.createRandomDirectory(DefaultStoragePath.parse(RodaConstants.STORAGE_CONTAINER_DIP)); dip.setId(directory.getStoragePath().getName()); } dip.setDateCreated(new Date()); dip.setLastModified(new Date()); createDIPMetadata(dip, directory.getStoragePath()); if (notify) { notifyDIPCreated(dip, false).failOnError(); } return dip; } catch (NotFoundException | RequestNotValidException | AlreadyExistsException e) { LOGGER.error("Error creating DIP in storage", e); throw new GenericException(e); } }