4 Replies Latest reply on Sep 11, 2014 10:09 PM by Catherine Shi

    How to use an instantiated variable into all the script tasks in a single jbpm process?

    Catherine Shi Newbie

      Dear all,

       

      My jBPM process (BPMN) is like:  START -->  DirectoryImport  -->  Process  -->  DirectoryStorage  -->  END

      I have three functions wanted to be invoke in each of the tasks in the process:

           public void doDImport();

           public void doProcess();

           public void doDExport();

      All the three functions are in com/myutil/ProcessClass.java

       

       

      What I want to do is like:

      1. Import 'com.myutil.ProcessClass' into 'DirectoryImport', 'Process', and 'DirectoryStorage'

       

      2. Instantiate 'ProcessClass' in 'DirectoryImport' script task:

      ProcessClass processClass = new ProcessClass();
      

       

      3. Use the instantiated variable in all the tasks:

           code in 'DirectoryImport' script task:

      ProcessClass processClass = new ProcessClass();
      processClass.doDImport();
      

       

           code in 'Process' script task:

      processClass.doProcess();
      

       

           code in 'DirectoryStorage' script task:

      processClass.doDirectoryStorage();
      

       

       

      But, the problem is:

      The variable 'processClass' instantiated in 'DirectoryImport' cannot be use in 'Process' and 'DirectoryStorage' , since it is not a global variable.

       

      How can I deal with this problem?

      How to use an instantiated variable into all the script tasks in a single jbpm process?

       

      Thank you all!

       

      Best,
      Catherine

       

       

      //Environment: jbpm 6.1.0   Eclipse_luna    jre7