Question

I'm using JPBM to design a process flow, with BPMN2. I want to instantiate a class object in a Script Task, for example:

Map<String, Object> params = new HashMap<String, Object>();    
Person p = new Person("moi");    
params.put("person", p);    
ksession.startProcess("com.sample.bpmn.hello", params);    

When I go into BPMN and create the process variable, so I can access it inside the script task, I get the following error: "Person cannot be resolved to a type"

How can I access that object through BPMN then? Thanks in advance

Was it helpful?

Solution

Figured it out. When creating the process variable, you have to define it as Object and provide the package path in Class Name. Instead of just creating an object, for example, of type Person, I had to actually type com.sample.Person, where com.sample is the package name. All variable reading and altering (get and set methods) is done with kcontext.getVariable("var") and kcontext.setVariable("var", newValue).

Hope this helps anyone :)

OTHER TIPS

To resolve that issue, import the Person class in the Process. For that open the properties of the process, there you can find imports property.

So you can import that Person class by adding imports. You have to specify the fully qualified name in class attribute.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top