5 Replies Latest reply on Sep 11, 2014 6:15 PM by Catherine Shi

    How to apply process variable to custom java class?

    Catherine Shi Newbie

      Dear all,

       

      I have a problem using process variable with my own java class.

       

      I have a java class written by myself named 'Pipeline.java'. There are two functions in 'Pipeline.java', one is doImport(), the other is doExport().

      And I have a process:  START -> WorkItemHandler1 -> WorkItemHandler2 -> END

       

      What I want to do is:

      Pipeline pipeline = new Pipeline(element);   <---- in Main

      Do pipeline.doImport();      <---- in WorkItemHandler1

      Do pipeline.doExport();      <---- in WorkItemHandler2

       

      What I have done is:

      In Main:

           Map<String, Object> params = new HashMap<String, Object>();

           params.put("pipeline", new Pipeline(element));

           startProcess(<your process id>, params)


      In process.bpmn Properties window:

           Added a variable [pipeline] with Object type

       

      In process.bpmn WorkItemHandler1 Properties window:

           I have a custom parameter named [pipelineParam] which is a ObjectDataType parameter.

       

      In process.bpmn WorkItemHandler2 Properties window:

           I have a custom parameter named [pipelineParam] which is a ObjectDataType parameter. (same as WorkItemHandler1)

       

      My question is

      1. How to let [pipelineParam] point to the [pipeline]?

      For example, if it was a integer type data, I can do like [pipelineParam] = #{pipeline}

      But what if it is an object type?

       

      2. I always get this error message while running as java application:

      0    [main] WARN  org.jbpm.ruleflow.core.validation.RuleFlowProcessValidator  - Process variable pipeline uses ObjectDataType for default type (java.lang) which could cause problems with setting variables, use dedicated type instead

       

      3. Is it right to use Object type in this case?

       

       

      I really need your help!

      Looking forward to some answers.

       

       

      Thanks!

       

      Regards,

      Catherine

       

      //Environment: jBPM 6, JRE 7, Eclipse luna, Win 7