Hi Kris, You were right - now it's working.
i had just copied the rule-constraint from annother sample i was basing my app on. didn't know that a code constraint was existing. is there a more low level documentation available that describes Drools on XML level (what types/keywords are allowed), or is there a possibility to download the http://drools.org/drools-5.0/process drools-processes-5.0.xsd ? when i'm trying to do so - i am always getting redirected to http://www.jboss.org/drools/index.html (using a normal Browser or a Download Manager) Regards ________________________________________ Von: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] im Auftrag von Kris Verlaenen [kris.verlae...@cs.kuleuven.be] Gesendet: Montag, 08. November 2010 01:19 An: Rules Users List Betreff: Re: [rules-users] [Drools Flow] checking Properties of supplied variables in constraints 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/trunk/target/docs/drools-flow/html/ch04.html#d0e1348 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@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users