public DescriptiveMetadata createDescriptiveMetadata(String aipId, String representationId,
String descriptiveMetadataId, ContentPayload payload, String descriptiveMetadataType,
String descriptiveMetadataVersion, boolean notify) throws RequestNotValidException, GenericException,
AlreadyExistsException, AuthorizationDeniedException, NotFoundException {
RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType);
StoragePath binaryPath = ModelUtils.getDescriptiveMetadataStoragePath(aipId, representationId,
descriptiveMetadataId);
boolean asReference = false;
storage.createBinary(binaryPath, payload, asReference);
DescriptiveMetadata descriptiveMetadata = new DescriptiveMetadata(descriptiveMetadataId, aipId, representationId,
descriptiveMetadataType, descriptiveMetadataVersion);
AIP aip = ResourceParseUtils.getAIPMetadata(getStorage(), aipId);
aip.addDescriptiveMetadata(descriptiveMetadata);
updateAIPMetadata(aip);
if (notify) {
notifyDescriptiveMetadataCreated(descriptiveMetadata).failOnError();
}
return descriptiveMetadata;
}