<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Calibri">Hi Kris,<br>
<br>
I hope you can help me.<br>
<br>
Here you have the whole code:<br>
<br>
public class RuleFlowTest {<br>
<br>
public static final void main(String[] args) {<br>
try {<br>
// load up the knowledge base<br>
KnowledgeBase kbase = readKnowledgeBase();<br>
StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();<br>
KnowledgeRuntimeLogger logger =
KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");<br>
// start a new process instance<br>
ksession.startProcess("com.sample.ruleflow");<br>
System.out.println("Waiting...");<br>
Person person = new Person();<br>
person.setName("Kevin");<br>
person.setSurname("Alonso");<br>
ksession.insert(person);<br>
logger.close();<br>
} catch (Throwable t) {<br>
t.printStackTrace();<br>
}<br>
}<br>
<br>
private static KnowledgeBase readKnowledgeBase() throws Exception {<br>
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();<br>
kbuilder.add(ResourceFactory.newClassPathResource("ruleflow.rf"),
ResourceType.DRF);<br>
KnowledgeBuilderErrors errors = kbuilder.getErrors();<br>
if (errors.size() > 0) {<br>
for (KnowledgeBuilderError error: errors) {<br>
System.err.println(error);<br>
}<br>
throw new IllegalArgumentException("Could not parse
knowledge.");<br>
}<br>
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();<br>
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());<br>
return kbase;<br>
}<br>
<br>
}<br>
<br>
Person Class:<br>
<br>
public class Person {<br>
String name;<br>
String surname;<br>
public String getName() {<br>
return name;<br>
}<br>
public void setName(String name) {<br>
this.name = name;<br>
}<br>
public String getSurname() {<br>
return surname;<br>
}<br>
public void setSurname(String surname) {<br>
this.surname = surname;<br>
}<br>
<br>
}<br>
<br>
<br>
And rf file.<br>
<br>
<?xml version="1.0" encoding="UTF-8"?> <br>
<process xmlns=<a class="moz-txt-link-rfc2396E" href="http://drools.org/drools-5.0/process">"http://drools.org/drools-5.0/process"</a><br>
xmlns:xs=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a><br>
xs:schemaLocation=<a class="moz-txt-link-rfc2396E" href="http://drools.org/drools-5.0/processdrools-processes-5.0.xsd">"http://drools.org/drools-5.0/process
drools-processes-5.0.xsd"</a><br>
type="RuleFlow" name="ruleflow" id="com.sample.ruleflow"
package-name="com.sample" ><br>
<br>
<header><br>
<imports><br>
<import name="com.sample.Person" /><br>
</imports><br>
</header><br>
<br>
<nodes><br>
<start id="1" name="Start" x="16" y="16" /><br>
<end id="3" name="End" x="480" y="277" width="80" height="40"
/><br>
<milestone id="4" name="Event Wait" x="130" y="17" width="80"
height="40" ><br>
<constraint type="rule" dialect="mvel"
>Person()</constraint><br>
</milestone><br>
<end id="5" name="End" x="312" y="275" width="80" height="40"
/><br>
<split id="6" name="Split" x="354" y="18" width="80" height="40"
type="2" ><br>
<constraints><br>
<constraint toNodeId="8" toType="DROOLS_DEFAULT" name="Not
Person" priority="1" type="rule" dialect="mvel" >not
Person()</constraint><br>
<constraint toNodeId="7" toType="DROOLS_DEFAULT"
name="Person" priority="1" type="rule" dialect="mvel"
>Person()</constraint><br>
</constraints><br>
</split><br>
<actionNode id="7" name="Action" x="482" y="185" width="80"
height="40" ><br>
<action type="expression" dialect="java"
>System.out.println("Person");</action><br>
</actionNode><br>
<actionNode id="8" name="Action" x="310" y="185" width="80"
height="40" ><br>
<action type="expression" dialect="mvel"
>System.out.println("No Person");</action><br>
</actionNode><br>
</nodes><br>
<br>
<connections><br>
<connection from="7" to="3" /><br>
<connection from="1" to="4" /><br>
<connection from="8" to="5" /><br>
<connection from="4" to="6" /><br>
<connection from="6" to="7" /><br>
<connection from="6" to="8" /><br>
</connections><br>
<br>
</process><br>
<br>
<br>
<br>
<br>
Kevin.<br>
</font><br>
Kris Verlaenen escribió:
<blockquote cite="mid:1253713590.4aba26b6cdd0f@webmail1.kuleuven.be"
type="cite">
<pre wrap="">Kevin,
Could you also post your process, so I can take a look and if necessary
try it out locally to see what is going on?
Kris
Quoting Kevin Alonso <a class="moz-txt-link-rfc2396E" href="mailto:kalonso@vicomtech.org"><kalonso@vicomtech.org></a>:
</pre>
<blockquote type="cite">
<pre wrap="">Hello,
I´m working with a simple flow that has a Event Wait node. This node
has the following condition:
- Person()
Being Person a class that is not inserted into the session yet.
When the flow arrives to the event wait node its execution stops and
the
test main class execution continues. Here I insert a Person object to
the session, so now, the flow can continue. After wait node I have a
Split node, which has the followings constraints:
- Person()
- not Person()
The flow always take the not Person() way. But now a Person instance
is
into the session.
Why is happening this?
Could anyone help me?
Thank you,
Kevin
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<pre wrap=""><!---->
Disclaimer: <a class="moz-txt-link-freetext" href="http://www.kuleuven.be/cwis/email_disclaimer.htm">http://www.kuleuven.be/cwis/email_disclaimer.htm</a>
</pre>
</blockquote>
</body>
</html>