@Override
public void run(IndexedAIP item)
throws GenericException, RequestNotValidException, AuthorizationDeniedException {
PluginState state = PluginState.SUCCESS;
try {
model.deleteAIP(item.getId());
} catch (NotFoundException e) {
state = PluginState.FAILURE;
reportItem.addPluginDetails("Could not delete AIP: " + e.getMessage());
}
String outcomeText;
if (state.equals(PluginState.SUCCESS)) {
outcomeText = PluginHelper.createOutcomeTextForAIP(item, "has been manually deleted");
} else {
outcomeText = PluginHelper.createOutcomeTextForAIP(item, "has not been manually deleted");
}
List<LinkingIdentifier> sources = new ArrayList<>();
sources
.add(PluginHelper.getLinkingIdentifier(item.getId(), RodaConstants.PRESERVATION_LINKING_OBJECT_SOURCE));
model.createEvent(item.getId(), null, null, null, PreservationEventType.DELETION, EVENT_DESCRIPTION,
sources, null, state, outcomeText, details, job.getUsername(), true);
}
}, e -> {