private void processAIP(ModelService model, Report report, JobPluginInfo jobPluginInfo, Job job, List<AIP> aips) {
for (AIP aip : aips) {
Report reportItem = PluginHelper.initPluginReportItem(this, aip.getId(), AIP.class);
PluginHelper.updatePartialJobReport(this, model, reportItem, false, job);
PluginState state = PluginState.SUCCESS;
try {
model.changeAIPType(aip.getId(), newType, job.getUsername());
} catch (RequestNotValidException | NotFoundException | GenericException | AuthorizationDeniedException e) {
state = PluginState.FAILURE;
} finally {
jobPluginInfo.incrementObjectsProcessed(state);
reportItem.setPluginState(state);
StringBuilder outcomeText = new StringBuilder().append("The AIP '").append(aip.getId())
.append("' changed its type from '").append(aip.getType()).append("' to '").append(newType).append("'.");
model.createUpdateAIPEvent(aip.getId(), null, null, null, PreservationEventType.UPDATE, EVENT_DESCRIPTION,
state, outcomeText.toString(), details, job.getUsername(), true);
report.addReport(reportItem);
PluginHelper.updatePartialJobReport(this, model, reportItem, true, job);
}
}
}