You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2023/05/26 13:19:06 UTC

[brooklyn-server] 01/08: allow use of overridden condition

This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit 1d2f6bf3c99dc48e6b79ed3da45bf36571892567
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Thu May 25 14:23:54 2023 +0100

    allow use of overridden condition
    
    e.g. when using a foreach, condition applies to elements in the list
---
 .../org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java
index 0319263f87..19c28a6baa 100644
--- a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java
+++ b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowExecutionContext.java
@@ -1279,9 +1279,10 @@ public class WorkflowExecutionContext {
             WorkflowStepDefinition step = getStepsResolved().get(currentStepIndex);
             if (step!=null) {
                 currentStepInstance = new WorkflowStepInstanceExecutionContext(currentStepIndex, step, WorkflowExecutionContext.this);
-                if (step.condition!=null) {
+                DslPredicates.DslPredicate conditionResolved = step.getConditionResolved(currentStepInstance);
+                if (conditionResolved!=null) {
                     if (log.isTraceEnabled()) log.trace("Considering condition "+step.condition+" for "+ workflowStepReference(currentStepIndex));
-                    boolean conditionMet = DslPredicates.evaluateDslPredicateWithBrooklynObjectContext(step.getConditionResolved(currentStepInstance), WorkflowExecutionContext.this, getEntityOrAdjunctWhereRunning());
+                    boolean conditionMet = DslPredicates.evaluateDslPredicateWithBrooklynObjectContext(conditionResolved, WorkflowExecutionContext.this, getEntityOrAdjunctWhereRunning());
                     if (log.isTraceEnabled()) log.trace("Considered condition "+step.condition+" for "+ workflowStepReference(currentStepIndex)+": "+conditionMet);
                     if (!conditionMet) {
                         moveToNextStep("Skipping step "+ workflowStepReference(currentStepIndex), false);