문제

I created a "New Rule" in drools guvnor. I want to create a fact with the process instance variables. The ruel I tried:

rule "CreatePersonFact"
    ruleflow-group "CreatePerson"
        dialect "mvel"
        when
            $process: WorkflowProcessInstance()
        then
            Person $person = new Person();
            $person.name=$processInstance.getVariable("person_name");
            $person.age=$processInstance.getVariable("age");
            $person.weight=$processInstance.getVariable("weight");
            insert($person);
    end

When I build the package I get the error "Unable to resolve ObjectType WorkflowProcessInstance"

I hope we should import org.drools.runtime.process.WorkflowProcessInstance in the rule to solve this error. How to add this import statement in the Guvnor's BRL editor?

도움이 되었습니까?

해결책

In Guvnor, imports are configured in the package and not in each rule. In the same window where you build your package there are a box where you can add your own import. By default you will see an entry for each class in your model, but you can add your own imports as well (as long as the class you import is in Guvnor's classpath).

Best Regards,

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top