Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
19. Mar 2008, 20:21 CET | Link

I'm following the instructions in the seam reference guide (1.2.1GA) on how to use drools within jbpm. Result so far in my simple example is that the flow always passes, regardless of what Test.getResult() returns. Can anyone tell me what I'm missing? Thanks!

The test case takes the 'pass' transition to id-approve, a decision node. The decision node always transitions to the fico node regardless of Test.result.

Test.java
-----------------------------------
package org.domain.RealHedge.Signup;

import org.jboss.seam.annotations.Name;

@Name("test")
public class Test {
	private String result = "BAD";

	public void setResult(String result) {
		this.result = result;||
	}
	public String getResult() {
		return result;
	}
}

acctApproval.drl
-----------------------
package AccountApproval

import org.domain.RealHedge.Signup.Test
import org.jboss.seam.drools.Decision

global Decision decision

rule "ID Authentication Approval"
  when
    Test( result == "GOOD" )
  then
    decision.setOutcome("pass");
end


components.xml:
------------------------------------------
  <drools:rule-base name="securityRules">
       <drools:rule-files>
           <value>/security.drl</value>
       </drools:rule-files>
   </drools:rule-base>
   
   <drools:rule-base name="accountApprovalRules">
   	<drools:rule-files>
        	<value>/accountApproval.drl</value>
    	</drools:rule-files>
   </drools:rule-base>
	
   <drools:managed-working-memory name="accountApprovalWorkingMemory" auto-create="true" rule-base="#{accountApprovalRules}"/>


createAcct.jbpm.xml:
--------------------
   <task-node name="id-start">
	<task name="id-start" description="ID Authentication">
	    <assignment pooled-actors="Administrator"/>
	</task>
      	<transition name="fail" to="id-review" />
        <transition name="pass" to="id-approve">
        </transition>
    </task-node>

    <task-node name="id-review">
    	<task name="id-review" description="ID Authentication Review">
    	    <assignment pooled-actors="Customer Service"/>
        </task>
	<transition to="id-failure" name="fail">
        </transition>
	<transition to="id-approve" name="pass">
        </transition>
    </task-node>

	<decision name="id-approve">
	    <handler class="org.jboss.seam.drools.DroolsDecisionHandler">
        	<workingMemoryName>accountApprovalWorkingMemory</workingMemoryName>
	        <assertObjects>
	            <element>#{test}</element>
	        </assertObjects>
    	</handler>
    	<transition name="pass" to="fico">
        	<action class="org.jboss.seam.drools.DroolsActionHandler">
            	<workingMemoryName>accountApprovalWorkingMemory</workingMemoryName>
	            <assertObjects>
	                <element>#{test}</element>
	            </assertObjects>
        	</action>
    	</transition>
		<transition to="id-failure"></transition>
	</decision>
	
	<task-node name="fico">
		<task name="fico" description="FICO Score">
			<assignment pooled-actors="Administrator"/>
		</task>
		<transition to="fico-review" name="fail"></transition>
		<transition to="avm" name="pass"></transition>
	</task-node>