Gregor,
Is there a reason why you are using rule constraints in your process?
It seems you are doing a simple evaluation of a process variable value,
in which case a simple code constraint like:
return "reviewer".equals(ticket.getType());
should work, and you'll have less changes of seeing strange side-effects.
The reason why I think you might be seeing some strange behavior with
rule constraints is that rules are evaluated on the session scope, not
for an individual process instance. So if you insert multiple objects
into the session (one Ticket for each process instance), once a rule is
valid for one process instance, it will probably be for the other as
well (unless you removed the object from the session before the second
process instance). Note that you could also refer to the actual value
of a process variable if you want to, as explained in the link below,
but in this case it seems a simple code constraint should be sufficient.
https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/t...
Kris
Gregor Ryba wrote:
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 <" +
ticket.getType() + ">");</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 <" +
ticket.getType() + ">");</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>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users