bluesoft-rnd / aperte-workflow-core

Aperte Workflow Core
https://demo.aperteworkflow.org
Other
35 stars 33 forks source link

Aperte with Drools #92

Closed veeras closed 12 years ago

veeras commented 12 years ago

Hi,

I am working with Aperte with Drool. I am able to fire simple rules, but i want to get the some output from drl file to next user task.

Can anybody help me on this..

Regards, Veera

tlipski commented 12 years ago

Veera, please review the following Drools rule:

import java.util.Map;
import pl.net.bluesoft.rnd.processtool.model.ProcessInstance;
import pl.net.bluesoft.rnd.processtool.model.ProcessInstanceSimpleAttribute;

global Map result;

rule 'marketing items'
dialect 'mvel'
when
    $pi : ProcessInstance()
    $inAttr : ProcessInstanceSimpleAttribute(key=="category", value=="marketing_items")
then
    result.put("logEntry", "process.log.ext.axa.substantial.marketing_items");
    result.put("value", "GROUP");
    ProcessInstanceSimpleAttribute attr = new ProcessInstanceSimpleAttribute();
    attr.setKey("substantialAcceptanceGroup");
    attr.setBpmVariableName("substantialAcceptanceGroup");
    attr.setValue("MARKETING_ACCEPT_QUEUE");
    $pi.addAttribute(attr);
end

In this example, we have added an attribute named 'substantialAcceptanceGroup' to the process instance data. This attribute will also be available to the BPM engine expressions (e.g. decision nodes).

By updating the result java.util.Map, we have also managed to supply result variable coming directly out of Drools step in the process execution.