Discussion:
[jboss-user] [jBPM] - Accessing simple process variable for Drools rule?
Patrick Steiner
2013-06-23 20:07:18 UTC
Permalink
Patrick Steiner [https://community.jboss.org/people/patste] created the discussion

"Accessing simple process variable for Drools rule?"

To view the discussion, visit: https://community.jboss.org/message/824469#824469

--------------------------------------------------------------
Hi,

I'm currently trying to learn jBPM & Drools, to be more precise, JBoss BRMS ...

Currently I'm stuck at a point where I could really need some help!

All the samples, e.g. the Car-Insurance sample from Eric Schabells Github repository do work with complex datatypes.
What I'm trying to achieve is much, much simpler - using the webbased process designer/Guvnor ...

Actually all I want is to extend Eric's brms-rewards-demo to the following:

1) add an 'amount' field to the process
2) dependent on value of the 'amount' a second approval

I have managed to extend the sample to do both, but now I would like to do the decission for 2) via a Drools rule.

Beeing a noop in this matter, I don't know how to proceed.

It would be great if someone here could point me to another sample or give me some  hint on how to proceed.

I  have added my "extended" version of Erics sample as an repository, just in case ...

Thanks a lot in advanced

Patrick
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/824469#824469]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-07-10 06:17:14 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Accessing simple process variable for Drools rule?"

To view the discussion, visit: https://community.jboss.org/message/827234#827234

--------------------------------------------------------------
Patrick, what you need to do to use rules within the process is following:
* define your rule within same package as the process and assign it with rule flow group attribute
* add business rule task into the process and fill in the rule flow group attribute of the task to the same value as you defined in the drl
* depending on what you are about to reason on you need to insert facts into the session - for simplicity you can use script task before the rule task to do so
that should evaluate the rules for given rule flow group when process instance is executed. Please note that in rule's consequence you need to do what ever is required to make the decision, like set process variable etc.

Alternatively you can use drools as a language of gateway's sequence flow condition and then use LHS from rule directly inside the process.

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/827234#827234]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Patrick Steiner
2013-07-17 20:30:41 UTC
Permalink
Patrick Steiner [https://community.jboss.org/people/patste] created the discussion

"Re: Accessing simple process variable for Drools rule?"

To view the discussion, visit: https://community.jboss.org/message/828496#828496

--------------------------------------------------------------
Hi Maciej,

thanks a lot for the answers. That was helpful.

For the alternative solution ... do you have or know of any sample for that? Sounds interesting, but I don't get how to do it.

Thanks a lot!

Patrick
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/828496#828496]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-07-24 16:25:44 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Accessing simple process variable for Drools rule?"

To view the discussion, visit: https://community.jboss.org/message/829567#829567

--------------------------------------------------------------
Patrick, take a look https://github.com/droolsjbpm/jbpm/blob/master/jbpm-bpmn2/src/test/resources/BPMN2-AdHocProcess.bpmn2#L43 here at the example bpmn2. Please note that you can select Rule language in BPMN2 Eclipse modeler too.

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/829567#829567]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...