private GeneralChangeProcessorScenarioType findScenario(String scenarioName) { for (GeneralChangeProcessorScenarioType scenario : processorConfigurationType.getScenario()) { if (scenarioName.equals(scenario.getName())) { return scenario; } } throw new SystemException("Scenario named " + scenarioName + " couldn't be found"); }
// region Processing model invocation @Override public HookOperationMode processModelInvocation( ModelContext context, Task taskFromModel, OperationResult result) throws SchemaException { if (processorConfigurationType.getScenario().isEmpty()) { LOGGER.warn("No scenarios for " + getBeanName()); } 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, result); } } LOGGER.trace("No scenario found to be applicable, exiting the change processor."); return HookOperationMode.FOREGROUND; }