@ApiOperation(value = "Delete a datastream in a ReDBox object", tags = "datastream")
@ApiImplicitParams({
@ApiImplicitParam(name = "skipReindex", value="Skip the reindex process. Useful if you are batching many changes to a ReDBox object at once.", required = false, allowMultiple = false, defaultValue = "false", dataType = "string"),
@ApiImplicitParam(name = "datastreamId", value="The identifier of the datastream", required = true, allowMultiple = false, dataType = "string") })
@Delete
public String deleteDatastream() throws FileUploadException, IOException, PluginException, MessagingException {
Storage storage = (Storage) ApplicationContextProvider.getApplicationContext().getBean("fascinatorStorage");
String oid = getAttribute("oid");
String payloadId = getQueryValue("datastreamId");
DigitalObject digitalObject = StorageUtils.getDigitalObject(storage, oid);
try {
@SuppressWarnings("unused")
Payload payload = digitalObject.getPayload(payloadId);
} catch (StorageException e) {
throw new ResourceException(404, e, "Datastream does not exist in the object");
}
digitalObject.removePayload(payloadId);
reindex(oid);
return getSuccessResponseString(oid);
}