]
Jiri Pechanec reopened JBRULES-1220:
------------------------------------
Integration with jBPM does not work
-----------------------------------
Key: JBRULES-1220
URL:
http://jira.jboss.com/jira/browse/JBRULES-1220
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 4.0.1
Reporter: Jiri Pechanec
Assigned To: Mark Proctor
Priority: Minor
Fix For: 4.0.2
We had a code that intgrates JBoss Rules Global Resolver with jBPM variable pool
workingMemory.setGlobalResolver(new GlobalResolver() {
private static final long serialVersionUID = 1L;
public Object resolveGlobal(String identifier) {
System.out.println("!!!!!!!!!! resolve " + identifier);
return ci.getVariable(identifier);
}
public void setGlobal(String identifier, Object value) {
System.out.println("!!!!!!!!!! set " + identifier);
ci.setVariable(identifier, value);
}
});
And a rule file that serves as test
package org.jbpm.action
import org.jbpm.resolveraction.Customer;
import org.jbpm.resolveraction.Order;
import org.jbpm.context.exe.ContextInstance;
global java.lang.String shipper
rule "Determine Shipper"
when
Customer( region >= 1 )
Order( totalAmount >= 0 )
then
System.out.println(shipper);
drools.getWorkingMemory().setGlobal( "shipper", "FEDX" );
System.out.println("ship via FEDX " );
end
The output of the test is as expected
11:50:51,226 INFO [STDOUT] !!!!!!!!!! resolve shipper
11:50:51,227 INFO [STDOUT] None
11:50:51,227 INFO [STDOUT] !!!!!!!!!! set shipper
11:50:51,227 INFO [STDOUT] ship via FEDX
But if we modify the rule file to
package org.jbpm.action
import org.jbpm.resolveraction.Customer;
import org.jbpm.resolveraction.Order;
import org.jbpm.context.exe.ContextInstance;
global java.lang.String shipper
rule "Determine Shipper"
when
eval ("None".equals(shipper))
Customer( region >= 1 )
Order( totalAmount >= 0 )
then
System.out.println(shipper);
drools.getWorkingMemory().setGlobal( "shipper", "FEDX" );
System.out.println("ship via FEDX " );
end
then nothing is printed - no attempt to resolve shipper global variable
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: