May we use setVariable()/getVariable() for a process variable which is not defined in a BPMN2 file?

Solution Unverified - Updated -

Issue

  • I can use setVariable()/getVariable() for a variable which is not defined in a BPMN2 file without issues. Is it a valid usage?
   ProcessInstance pi = ksession.startProcess("com.sample.bpmn.hello");
   long piid = pi.getId();

   tm.begin();
   WorkflowProcessInstance pi2 = (WorkflowProcessInstance)ksession.getProcessInstance(piid);
   pi2.setVariable("AAA", "4321"); // NOTE: "AAA" is not defined in BPMN file
   tm.commit();

   WorkflowProcessInstance pi3 = (WorkflowProcessInstance)ksession.getProcessInstance(piid, true);
   System.out.println(pi3.getVariable("AAA"));

Environment

  • Red Hat JBoss BPM Suite
    • 6.0.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In