// 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;
  }
 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 Initialization and Configuration
 @PostConstruct
 public void init() {
   processorConfigurationType = gcpConfigurationHelper.configure(this);
   if (isEnabled()) {
     // print startup message
     int scenarios = processorConfigurationType.getScenario().size();
     if (scenarios > 0) {
       LOGGER.info(
           getBeanName() + " initialized correctly (number of scenarios: " + scenarios + ")");
     } else {
       LOGGER.warn(
           getBeanName()
               + " initialized correctly, but there are no scenarios - so it will never be invoked");
     }
   }
 }