private void processAIP(IndexService index, ModelService model, Report report, Job job, AIP aip) {
Report reportItem = PluginHelper.initPluginReportItem(this, aip.getId(), AIP.class, AIPState.INGEST_PROCESSING);
PluginHelper.updatePartialJobReport(this, model, reportItem, false, job);
String outcomeDetail = "";
try {
LOGGER.debug("Auto accepting AIP {}", aip.getId());
if (aip.getState() != AIPState.ACTIVE) {
aip.setState(AIPState.ACTIVE);
model.updateAIPState(aip, job.getUsername());
}
reportItem.setPluginState(PluginState.SUCCESS).setOutcomeObjectState(AIPState.ACTIVE);
LOGGER.debug("Done with auto accepting AIP {}", aip.getId());
} catch (RODAException e) {
LOGGER.error("Error updating AIP (metadata attribute state=ACTIVE)", e);
outcomeDetail = "Error updating AIP (metadata attribute state=ACTIVE): " + e.getMessage();
reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(outcomeDetail)
.setOutcomeObjectState(AIPState.UNDER_APPRAISAL);
}
try {
boolean notify = true;
PluginHelper.createPluginEvent(this, aip.getId(), model, index, reportItem.getPluginState(), outcomeDetail,
notify);
} catch (ValidationException | RequestNotValidException | NotFoundException | GenericException
| AuthorizationDeniedException | AlreadyExistsException e) {
LOGGER.error("Error creating event: {}", e.getMessage(), e);
}
report.addReport(reportItem);
PluginHelper.updatePartialJobReport(this, model, reportItem, true, job);
}