[jboss-user] [jBPM] - Process variables, rules, Gateway constraints

Gary Struthers do-not-reply at jboss.com
Wed Jul 20 22:23:26 EDT 2011


Gary Struthers [http://community.jboss.org/people/GaryS] created the discussion

"Process variables, rules, Gateway constraints"

To view the discussion, visit: http://community.jboss.org/message/616560#616560

--------------------------------------------------------------
I followed Accessing process variables in rule-task (http://community.jboss.org/message/607839#607839)  http://community.jboss.org/message/607839#607839#607839 http://community.jboss.org/message/607839#607839
But I'm starting a new thread because I have new problems and that thread was marked as answered.
I'm missing something important about how to handle variables in rules and constraints but I can't find it.

A JUnit4 test fails when I call fireAllRules()
org.drools.RuntimeDroolsException: Unexpected exception executing action org.jbpm.process.instance.event.DefaultSignalManager$SignalAction at 3e4ac866
          at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1000)
          at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:733)
          at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:702)
          at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)

  @Test 
public void assignApplication() throws Exception {
  // given 
                    StatefulKnowledgeSession kSession = createKnowledgeSession(getKbase());
                    String ready = new String("false");
                    String assignLHS = new String("true");
                    Map<String, Object> params = new HashMap<String, Object>();
                    params.put("ready", ready);
                    params.put("assignLHS", assignLHS);
                    ProcessInstance pi = kSession.startProcess("dummy", params);
this.assertNodeTriggered(pi.getId(), "Start","AddPiFact", "Assign Application");
                    kSession.fireAllRules();

AddPiFact is a script immediately after Start with this action:
*import* org.drools.runtime.KnowledgeContext
*import* org.drools.runtime.KnowledgeRuntime

kcontext.getKnowledgeRuntime().*insert*(kcontext.getProcessInstance());

The rule is supposed to set "ready" if "assignLHS" is true
import org.drools.runtime.process.WorkflowProcessInstance

 rule "applicationReady"
    ruleflow-group "assignApplication"
when
        $process: WorkflowProcessInstance()
        $assignLHS :String() from (String)$process.getVariable("assignLHS");
eval($assignLHS == "true");
then
        $process.setVariable("ready", "true");
update($process);
end

I want an XOR Gateway to use "ready" in its Constraints but if I write it like
return ready.compareIgnoreCase("true");

The KnowledgeBuilder has an error that "ready" can't be resolved.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/616560#616560]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110720/621f9f73/attachment-0001.html 


More information about the jboss-user mailing list