[rules-users] [Drools Flow] checking Properties of supplied variables in constraints

Gregor Ryba Gregor.Ryba at infor.com
Fri Nov 5 08:17:11 EDT 2010


Hi,

i am supplying an object as variable to my workflow. in a split i try to check the property "Type" of the
supplied object and according to it move on to the next actionnode (for testing purposes).
in the actionnode i am setting a string, that i am printing out later.

my test looks as follows:

first i supply a ticket with type "reviewer"
after this i supply a ticket with type "developer"

BUT i'm getting the following output:

Output1: processing developer ticket <reviewer>
Output2: processing developer ticket <developer>

so the ticket-object is injected correctly into the workflow, but
i have no clue, why the developer constraint is taken both times

any hints?


---------workflow file used------------

  <?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
         xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
         type="RuleFlow" name="Task Test" id="tasktest" package-name="workflows" routerLayout="2" >

  <header>
    <variables>
      <variable name="ticket" >
        <type name="org.drools.process.core.datatype.impl.type.ObjectDataType" className="org.openengsb.core.taskbox.model.Ticket" />
      </variable>
    </variables>
  </header>

  <nodes>
    <start id="1" name="Start" x="103" y="26" width="49" height="49" />
    <end id="2" name="End" x="107" y="393" width="49" height="49" />
    <split id="7" name="Gateway" x="103" y="116" width="49" height="49" type="1" >
      <constraints>
        <constraint toNodeId="9" toType="DROOLS_DEFAULT" name="reviewer" priority="2" type="rule" dialect="java" >(ticket.getType()=="reviewer")</constraint>
        <constraint toNodeId="8" toType="DROOLS_DEFAULT" name="developer" priority="1" type="rule" dialect="java" >(ticket.getType()=="developer")</constraint>
      </constraints>
    </split>
    <actionNode id="8" name="dev" x="42" y="205" width="80" height="48" >
        <action type="expression" dialect="java" >taskbox.setWorkflowMessage("processing developer ticket &lt;" + ticket.getType() + "&gt;");</action>
    </actionNode>
    <actionNode id="9" name="rev" x="150" y="205" width="80" height="48" >
        <action type="expression" dialect="java" >taskbox.setWorkflowMessage("processing reviewer ticket &lt;" + ticket.getType() + "&gt;");</action>
    </actionNode>
    <join id="10" name="Gateway" x="104" y="302" width="49" height="49" type="2" />
  </nodes>

  <connections>
    <connection from="10" to="2" />
    <connection from="1" to="7" />
    <connection from="7" to="8" />
    <connection from="7" to="9" />
    <connection from="8" to="10" />
    <connection from="9" to="10" />
  </connections>

</process>




More information about the rules-users mailing list