Skip to content

Commit

Permalink
fix activation condition
Browse files Browse the repository at this point in the history
  • Loading branch information
elguardian committed Jun 5, 2024
1 parent 6ba74e0 commit 56f5a6b
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.Stream;

import org.jbpm.compiler.canonical.builtin.ReturnValueEvaluatorBuilderService;
Expand Down Expand Up @@ -61,16 +60,13 @@ protected String getDefaultName() {

@Override
public Stream<MethodCallExpr> visitCustomFields(DynamicNode node, VariableScope variableScope) {
if (node.isAutoComplete()) {
return Collections.<MethodCallExpr> emptyList().stream();
}

Collection<MethodCallExpr> methods = new ArrayList<>();
methods.add(getFactoryMethod(getNodeId(node), METHOD_LANGUAGE, getOrNullExpr(node.getLanguage())));
if (node.getActivationCondition() != null && !node.getActivationCondition().isBlank()) {
methods.add(getActivationConditionStatement(node));
}
if (node.getCompletionCondition() != null && !node.getCompletionCondition().isBlank()) {
if (!node.isAutoComplete() && node.getCompletionCondition() != null && !node.getCompletionCondition().isBlank()) {
methods.add(getCompletionConditionStatement(node));
}
return methods.stream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
Expand Down Expand Up @@ -120,7 +121,7 @@ private NodeInstance givenExistingNode(String nodeId) {
when(process.getNodesRecursively()).thenReturn(Arrays.asList(node));

NodeInstance nodeInstance = mock(NodeInstance.class);
when(wpi.getNodeInstance(node)).thenReturn(nodeInstance);
when(wpi.getByNodeDefinitionId(eq(node.getUniqueId()), any())).thenReturn(nodeInstance);
return nodeInstance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
</bpmn2:resourceAssignmentExpression>
</bpmn2:potentialOwner>
</bpmn2:userTask>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_Vpzp0u1BEeal0opAuGgvLw" language="http://www.jboss.org/drools/rule"><![CDATA[caseFile_customData != null]]></bpmn2:completionCondition>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_Vpzp0u1BEeal0opAuGgvLw" language="http://www.java.com/java"><![CDATA[caseFile_customData != null]]></bpmn2:completionCondition>
</bpmn2:adHocSubProcess>
<bpmn2:adHocSubProcess id="_1BB26695-2446-48FF-B1E8-102236021CAB" drools:selectable="true" color:background-color="#fafad2" color:border-color="#000000" color:color="#000000" name="Stage Two" ordering="Sequential">
<bpmn2:extensionElements>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
</bpmn2:resourceAssignmentExpression>
</bpmn2:potentialOwner>
</bpmn2:userTask>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="__T-3Q-4EEeal0opAuGgvLw" language="http://www.jboss.org/drools/rule"><![CDATA[caseFile_customData.equals("none")]]></bpmn2:completionCondition>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="__T-3Q-4EEeal0opAuGgvLw" language="http://www.java.com/java"><![CDATA[caseFile_customData.equals("none")]]></bpmn2:completionCondition>
</bpmn2:adHocSubProcess>
<bpmn2:adHocSubProcess id="_1BB26695-2446-48FF-B1E8-102236021CAB" drools:selectable="true" color:background-color="#fafad2" color:border-color="#000000" color:color="#000000" name="Stage Two" ordering="Sequential">
<bpmn2:extensionElements>
Expand Down Expand Up @@ -148,7 +148,7 @@
</bpmn2:resourceAssignmentExpression>
</bpmn2:potentialOwner>
</bpmn2:userTask>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="__T-3Vu4EEeal0opAuGgvLw" language="http://www.jboss.org/drools/rule"><![CDATA[caseFile_customData.equals("none")]]></bpmn2:completionCondition>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="__T-3Vu4EEeal0opAuGgvLw" language="http://www.java.com/java"><![CDATA[caseFile_customData.equals("none")]]></bpmn2:completionCondition>
</bpmn2:adHocSubProcess>
<bpmn2:sequenceFlow id="_4B6721A9-3253-43AB-821C-7EC0298E7409" drools:selectable="true" color:background-color="#000000" color:border-color="#000000" color:color="#000000" sourceRef="_97793062-93A6-4CC8-9DB8-43F30BC001E9" targetRef="_51298678-656D-434C-A1D1-912CA47417AE"/>
<bpmn2:sequenceFlow id="_0F304A8D-0D85-4F48-8CC0-AD7E4BCA6833" drools:selectable="true" color:background-color="#000000" color:border-color="#000000" color:color="#000000" sourceRef="_51298678-656D-434C-A1D1-912CA47417AE" targetRef="_1BB26695-2446-48FF-B1E8-102236021CAB"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<bpmn2:inputSet id="_JaoAglAwEeekOsAiqAUZKw"/>
<bpmn2:outputSet id="_JaoAg1AwEeekOsAiqAUZKw"/>
</bpmn2:ioSpecification>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_JaoAhFAwEeekOsAiqAUZKw" language="http://www.jboss.org/drools/rule"><![CDATA[v$continue]]></bpmn2:completionCondition>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_JaoAhFAwEeekOsAiqAUZKw" language="http://www.java.com/java"><![CDATA[continue == true]]></bpmn2:completionCondition>
</bpmn2:adHocSubProcess>
<bpmn2:startEvent id="_CFF602B7-06FA-4BAD-907D-003FACBC5357" drools:selectable="true" color:background-color="#9acd32" color:border-color="#000000" color:color="#000000" name="">
<bpmn2:extensionElements>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ System.out.println(&quot;timer on stage 1&quot;);</bpmn2:script>
</bpmn2:assignment>
</bpmn2:dataInputAssociation>
</bpmn2:userTask>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_pGbIkjuFEeqlirl1r42RDw" language="http://www.jboss.org/drools/rule">caseFile_stage1_finished</bpmn2:completionCondition>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_pGbIkjuFEeqlirl1r42RDw" language="http://www.java.com/java">caseFile_stage1_finished</bpmn2:completionCondition>
</bpmn2:adHocSubProcess>
<bpmn2:boundaryEvent id="_9BA107AB-9119-489E-873F-319C80A3D872" drools:selectable="true" drools:boundaryca="false" drools:dockerinfo="147.0^144.0|" color:background-color="#f5deb3" color:border-color="#a0522d" color:color="#000000" name="boundaryEvent" attachedToRef="_C962DC6C-D200-459A-81B3-DC6AF084EFEE" cancelActivity="false">
<bpmn2:extensionElements>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
</bpmn2:potentialOwner>
</bpmn2:userTask>
<bpmn2:sequenceFlow id="_E5F867A9-66A2-4547-BBD0-1C9016701461" drools:selectable="true" color:background-color="#000000" color:border-color="#000000" color:color="#000000" sourceRef="_E31E7C8E-2AD1-4C96-9D5D-A1452E7453E0" targetRef="_9DAB7DE8-EE33-45DB-983C-FA65D9558D6D"/>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_al78q2U5Eeavbo3IsNuQ1g" language="http://www.jboss.org/drools/rule"><![CDATA[Boolean.parseBoolean((String)kcontext.getVariable("readyToComplete"))]]></bpmn2:completionCondition>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_al78q2U5Eeavbo3IsNuQ1g" language="http://www.java.com/java"><![CDATA[Boolean.parseBoolean((String)kcontext.getVariable("readyToComplete"))]]></bpmn2:completionCondition>
</bpmn2:adHocSubProcess>
<bpmn2:endEvent id="_5654F923-EC6D-4D65-8855-0FDF860934B8" drools:selectable="true" color:background-color="#ff6347" color:border-color="#000000" color:color="#000000" name="">
<bpmn2:extensionElements>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
</bpmn2:potentialOwner>
</bpmn2:userTask>
<bpmn2:sequenceFlow id="_E5F867A9-66A2-4547-BBD0-1C9016701461" drools:selectable="true" color:background-color="#000000" color:border-color="#000000" color:color="#000000" sourceRef="_E31E7C8E-2AD1-4C96-9D5D-A1452E7453E0" targetRef="_9DAB7DE8-EE33-45DB-983C-FA65D9558D6D"/>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_al78q2U5Eeavbo3IsNuQ1g" language="http://www.jboss.org/drools/rule"><![CDATA[Boolean.parseBoolean((String)kcontext.getVariable("readyToComplete"))]]></bpmn2:completionCondition>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_al78q2U5Eeavbo3IsNuQ1g" language="http://www.java.com/java"><![CDATA[Boolean.parseBoolean((String)kcontext.getVariable("readyToComplete"))]]></bpmn2:completionCondition>
</bpmn2:adHocSubProcess>
<bpmn2:endEvent id="_5654F923-EC6D-4D65-8855-0FDF860934B8" drools:selectable="true" color:background-color="#ff6347" color:border-color="#000000" color:color="#000000" name="end">
<bpmn2:extensionElements>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
</bpmn2:resourceAssignmentExpression>
</bpmn2:potentialOwner>
</bpmn2:userTask>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_WpO30URnEeeSxP1_nretag" language="http://www.jboss.org/drools/rule"><![CDATA[(Boolean)kcontext.getVariable("continue")]]></bpmn2:completionCondition>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_WpO30URnEeeSxP1_nretag" language="http://www.java.com/java"><![CDATA[(Boolean)kcontext.getVariable("continue")]]></bpmn2:completionCondition>
</bpmn2:adHocSubProcess>
<bpmn2:startEvent id="_E043B6D5-4CE0-418A-A39A-F506F223801C" drools:selectable="true" color:background-color="#9acd32" color:border-color="#000000" color:color="#000000" name="">
<bpmn2:extensionElements>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
</bpmn2:resourceAssignmentExpression>
</bpmn2:potentialOwner>
</bpmn2:userTask>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_WpO30URnEeeSxP1_nretag" language="http://www.jboss.org/drools/rule"><![CDATA[(Integer)kcontext.getVariable("continue") == 1]]></bpmn2:completionCondition>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_WpO30URnEeeSxP1_nretag" language="http://www.java.com/java"><![CDATA[(Integer)kcontext.getVariable("continue") == 1]]></bpmn2:completionCondition>
</bpmn2:adHocSubProcess>
<bpmn2:startEvent id="_E043B6D5-4CE0-418A-A39A-F506F223801C" drools:selectable="true" color:background-color="#9acd32" color:border-color="#000000" color:color="#000000" name="">
<bpmn2:extensionElements>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
</bpmn2:resourceAssignmentExpression>
</bpmn2:potentialOwner>
</bpmn2:userTask>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_WpO30URnEeeSxP1_nretag" language="http://www.jboss.org/drools/rule"><![CDATA[kcontext.getVariable("continue").equals("continue")]]></bpmn2:completionCondition>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression" id="_WpO30URnEeeSxP1_nretag" language="http://www.java.com/java"><![CDATA[kcontext.getVariable("continue").equals("continue")]]></bpmn2:completionCondition>
</bpmn2:adHocSubProcess>
<bpmn2:startEvent id="_E043B6D5-4CE0-418A-A39A-F506F223801C" drools:selectable="true" color:background-color="#9acd32" color:border-color="#000000" color:color="#000000" name="">
<bpmn2:extensionElements>
Expand Down

0 comments on commit 56f5a6b

Please sign in to comment.