1 Reply Latest reply on Apr 15, 2013 4:14 AM by Jiri Svitak

    Start an Process From a State

    7ab3rn4t3 7ab3rn4t3 Newbie



      let's suppose that


      I start a process in this way from a Servlet


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

      params.put("name", "Arthur");


      ProcessInstance istance = ksession.startProcess("com.sample.bpmn.hello", params);


      and put it in the httpSession.... am I correct?


      let's suppose that on the state 5 I will save in my DB my process params (I don't know how yet!!!!!!!!!)


      first of all:

      How can I get that params map from a UserTask or Script in JBPM so that I can make a Class that save them on my db????


      the Tomorrow

      I reLoad my page and want to create a new process that begin from the state that I left the day before.

      Of course I can detect the state by a parmeter saved in that map.....


      but is there a way to begin a process from a specific state ?

      which is ?


      Thanks in advance


        • 1. Re: Start an Process From a State
          Jiri Svitak Novice

          Hello Fabio,


          I am not sure if I have correctly understood your scenario. But you can implement own service tasks - work item definitions and handlers for them, which are java classes. Refer to Domain-specific processes chapter in the documentation. In these service tasks you can implement own java code, which is able to query database for information or to persist some information to the database.


          Usually you start business process, it runs several nodes and stops for example at the first human task. The process execution ends here and engine returns from startProcess method. You can restore the engine execution when completing a task. User completes his task and immediately in the same time the process execution is restored in order to execute next nodes in process flow. I can recommend the book jBPM 5 Developer Guide, where you can find more information how to develop these scenarios.


          Params which you supply when starting the process are mapped to process variables, these can be accessed anywhere in the process directly or using kcontext, refer to 6.8.1 Data section of the documentation for more details.


          I do not know what you mean by 'a specific state'. Usually the execution of suspended process is restored after human task, or asynchronous service task. If you want to start another flow in the process during its execution, use signals and catch events.