Accessing ActivityExecution in Business Rules

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2014 02:21 AM
Can i access executionContext in Business rule.
my goal is to write some rules based on process variables.
for instance
when context.getVariable('amount') > 100
then context.setvariable('accepetd',true)
If possible how can i do that?
my goal is to write some rules based on process variables.
for instance
when context.getVariable('amount') > 100
then context.setvariable('accepetd',true)
If possible how can i do that?
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2014 02:56 AM
Hi,
The activiti user guide says:
http://www.activiti.org/userguide/#bpmnBusinessRuleTask
Regards
Martin
The activiti user guide says:
http://www.activiti.org/userguide/#bpmnBusinessRuleTask
For the input variable definition a list of process variables can be defined separated by a comma.
Regards
Martin

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2014 03:05 AM
Yeah and its simply applying rules on those variable if the conditions meet the rule criteria.
however you cannot write a rule for primitive variables!!. So de default behavior doesn't helpt me much.
for instance how can you say in Rule that
when variable x is grather than 100 then ….
I found the solution anyway i extended BusinessRuleBehaviour and put the execution Context in the knowledgebase before firing rules and now i can write a rule such as
import org.activiti.engine.impl.pvm.delegate.ActivityExecution
rule "TestExecution"
dialect "java"
when
execution : ActivityExecution(getVariable("v_v") == "tech")
then
execution.setVariable("v_v2",200);
System.out.println("After Then XXX");
end
however you cannot write a rule for primitive variables!!. So de default behavior doesn't helpt me much.
for instance how can you say in Rule that
when variable x is grather than 100 then ….
I found the solution anyway i extended BusinessRuleBehaviour and put the execution Context in the knowledgebase before firing rules and now i can write a rule such as
import org.activiti.engine.impl.pvm.delegate.ActivityExecution
rule "TestExecution"
dialect "java"
when
execution : ActivityExecution(getVariable("v_v") == "tech")
then
execution.setVariable("v_v2",200);
System.out.println("After Then XXX");
end
