@Override
public HookOperationMode processModelInvocation(@NotNull ModelContext context, WfConfigurationType wfConfigurationType, @NotNull Task taskFromModel, @NotNull OperationResult result) throws SchemaException {
if (wfConfigurationType != null && wfConfigurationType.getGeneralChangeProcessor() != null && Boolean.FALSE.equals(wfConfigurationType.getGeneralChangeProcessor().isEnabled())) {
LOGGER.trace("{} is disabled", getBeanName());
return null;
}
if (wfConfigurationType == null || wfConfigurationType.getGeneralChangeProcessor() == null || wfConfigurationType.getGeneralChangeProcessor().getScenario().isEmpty()) {
LOGGER.trace("No scenarios for {}", getBeanName());
return null;
}
GeneralChangeProcessorConfigurationType processorConfigurationType = wfConfigurationType.getGeneralChangeProcessor();
for (GeneralChangeProcessorScenarioType scenarioType : processorConfigurationType.getScenario()) {
GcpScenarioBean scenarioBean = findScenarioBean(scenarioType.getBeanName());
if (Boolean.FALSE.equals(scenarioType.isEnabled())) {
LOGGER.trace("scenario {} is disabled, skipping", scenarioType.getName());
} else if (!gcpExpressionHelper.evaluateActivationCondition(scenarioType, context, taskFromModel, result)) {
LOGGER.trace("activationCondition was evaluated to FALSE for scenario named {}", scenarioType.getName());
} else if (!scenarioBean.determineActivation(scenarioType, context, taskFromModel, result)) {
LOGGER.trace("scenarioBean decided to skip scenario named {}", scenarioType.getName());
} else {
LOGGER.trace("Applying scenario {} (process name {})", scenarioType.getName(), scenarioType.getProcessName());
return applyScenario(scenarioType, scenarioBean, context, taskFromModel, wfConfigurationType, result);
}
}
LOGGER.trace("No scenario found to be applicable, exiting the change processor.");
return null;
}