private String createAdHocCompletionRule(Process process, DynamicNode dynamicNode) { return "rule \"RuleFlow-AdHocComplete-" + process.getId() + "-" + dynamicNode.getUniqueId() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + dynamicNode.getCompletionExpression() + "\n" + " then \n" + "end \n\n"; }
public void nodeInstanceCompleted(org.jbpm.workflow.instance.NodeInstance nodeInstance, String outType) { Node nodeInstanceNode = nodeInstance.getNode(); if( nodeInstanceNode != null ) { Object compensationBoolObj = nodeInstanceNode.getMetaData().get("isForCompensation"); boolean isForCompensation = compensationBoolObj == null ? false : ((Boolean) compensationBoolObj); if( isForCompensation ) { return; } } String completionCondition = getDynamicNode().getCompletionExpression(); // TODO what if we reach the end of one branch but others might still need to be created ? // TODO are we sure there will always be node instances left if we are not done yet? if (isTerminated(nodeInstance)) { triggerCompleted(NodeImpl.CONNECTION_DEFAULT_TYPE); } else if (getDynamicNode().isAutoComplete() && getNodeInstances(false).isEmpty()) { triggerCompleted(NodeImpl.CONNECTION_DEFAULT_TYPE); } else if (completionCondition != null && "mvel".equals(getDynamicNode().getLanguage())) { Object value = MVELSafeHelper.getEvaluator().eval(completionCondition, new NodeInstanceResolverFactory(this)); if ( !(value instanceof Boolean) ) { throw new RuntimeException( "Completion condition expression must return boolean values: " + value + " for expression " + completionCondition); } if (((Boolean) value).booleanValue()) { triggerCompleted(NodeImpl.CONNECTION_DEFAULT_TYPE); } } }
if ( nodes[i] instanceof DynamicNode) { DynamicNode dynamicNode = (DynamicNode) nodes[i]; if (dynamicNode.getCompletionExpression() != null && "rule".equals(((DynamicNode) nodes[i]).getLanguage())) { builder.append( createAdHocCompletionRule( process, dynamicNode ) );
assertThat(stage.getName()).isEqualTo("First stage"); assertThat(stage.getActivationExpression()).isEqualTo("org.kie.api.runtime.process.CaseData(data.get(\"ordered\") !=null)"); assertThat(stage.getCompletionExpression()).isEqualTo("org.kie.api.runtime.process.CaseData(data.get(\"shipped\") !=null)");
assertThat(stage.getName()).isEqualTo("First stage"); assertThat(stage.getActivationExpression()).isEqualTo("org.kie.api.runtime.process.CaseData(data.get(\"ordered\") !=null)"); assertThat(stage.getCompletionExpression()).isEqualTo("org.kie.api.runtime.process.CaseData(data.get(\"shipped\") !=null)");
assertThat(stage.getName()).isEqualTo("First stage"); assertThat(stage.getActivationExpression()).isNull(); assertThat(stage.getCompletionExpression()).isNull();
if ("".equals(dynamicNode.getCompletionExpression()) && !dynamicNode.isAutoComplete()) { addErrorMessage(process, node,
private String createAdHocCompletionRule(Process process, DynamicNode dynamicNode) { return "rule \"RuleFlow-AdHocComplete-" + process.getId() + "-" + dynamicNode.getUniqueId() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + dynamicNode.getCompletionExpression() + "\n" + " then \n" + "end \n\n"; }
public void nodeInstanceCompleted(org.jbpm.workflow.instance.NodeInstance nodeInstance, String outType) { Node nodeInstanceNode = nodeInstance.getNode(); if( nodeInstanceNode != null ) { Object compensationBoolObj = nodeInstanceNode.getMetaData().get("isForCompensation"); boolean isForCompensation = compensationBoolObj == null ? false : ((Boolean) compensationBoolObj); if( isForCompensation ) { return; } } String completionCondition = getDynamicNode().getCompletionExpression(); // TODO what if we reach the end of one branch but others might still need to be created ? // TODO are we sure there will always be node instances left if we are not done yet? if (isTerminated(nodeInstance)) { triggerCompleted(NodeImpl.CONNECTION_DEFAULT_TYPE); } else if (getDynamicNode().isAutoComplete() && getNodeInstances(false).isEmpty()) { triggerCompleted(NodeImpl.CONNECTION_DEFAULT_TYPE); } else if (completionCondition != null && "mvel".equals(getDynamicNode().getLanguage())) { Object value = MVELSafeHelper.getEvaluator().eval(completionCondition, new NodeInstanceResolverFactory(this)); if ( !(value instanceof Boolean) ) { throw new RuntimeException( "Completion condition expression must return boolean values: " + value + " for expression " + completionCondition); } if (((Boolean) value).booleanValue()) { triggerCompleted(NodeImpl.CONNECTION_DEFAULT_TYPE); } } }
if ( nodes[i] instanceof DynamicNode) { DynamicNode dynamicNode = (DynamicNode) nodes[i]; if (dynamicNode.getCompletionExpression() != null && "rule".equals(((DynamicNode) nodes[i]).getLanguage())) { builder.append( createAdHocCompletionRule( process, dynamicNode ) );
assertThat(stage.getName()).isEqualTo("First stage"); assertThat(stage.getActivationExpression()).isNull(); assertThat(stage.getCompletionExpression()).isNull();
assertThat(stage.getName()).isEqualTo("First stage"); assertThat(stage.getActivationExpression()).isEqualTo("org.kie.api.runtime.process.CaseData(data.get(\"ordered\") !=null)"); assertThat(stage.getCompletionExpression()).isEqualTo("org.kie.api.runtime.process.CaseData(data.get(\"shipped\") !=null)");
assertThat(stage.getName()).isEqualTo("First stage"); assertThat(stage.getActivationExpression()).isEqualTo("org.kie.api.runtime.process.CaseData(data.get(\"ordered\") !=null)"); assertThat(stage.getCompletionExpression()).isEqualTo("org.kie.api.runtime.process.CaseData(data.get(\"shipped\") !=null)");
if ("".equals(dynamicNode.getCompletionExpression()) && !dynamicNode.isAutoComplete()) { addErrorMessage(process, node,