use of com.evolveum.midpoint.wf.impl.processors.ChangeProcessor in project midpoint by Evolveum.
the class WfHook method processModelInvocation.
private HookOperationMode processModelInvocation(@NotNull ModelContext<? extends ObjectType> modelContext, WfConfigurationType wfConfigurationType, @NotNull Task taskFromModel, @NotNull OperationResult result) {
try {
modelContext.reportProgress(new ProgressInformation(WORKFLOWS, ENTERING));
for (ChangeProcessor changeProcessor : wfConfiguration.getChangeProcessors()) {
LOGGER.trace("Trying change processor: {}", changeProcessor.getClass().getName());
try {
HookOperationMode hookOperationMode = changeProcessor.processModelInvocation(modelContext, wfConfigurationType, taskFromModel, result);
if (hookOperationMode != null) {
return hookOperationMode;
}
} catch (ObjectNotFoundException | SchemaException | RuntimeException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Exception while running change processor {}", e, changeProcessor.getClass().getName());
result.recordFatalError("Exception while running change processor " + changeProcessor.getClass(), e);
return HookOperationMode.ERROR;
}
}
} finally {
if (result.isInProgress()) {
// a bit of hack: IN_PROGRESS for workflows actually means "success"
OperationResult r = result.clone();
r.recordSuccess();
modelContext.reportProgress(new ProgressInformation(WORKFLOWS, r));
} else {
modelContext.reportProgress(new ProgressInformation(WORKFLOWS, result));
}
}
LOGGER.trace("No change processor caught this request, returning the FOREGROUND flag.");
return HookOperationMode.FOREGROUND;
}
Aggregations