2 Replies Latest reply on Oct 7, 2010 10:08 AM by gianluc ricciardi

    restart running process

    gianluc ricciardi Newbie

           Hi all, I'm newbie in Jbpm 4 , I didn't find anything about  restarting running process.

      I have these situations. If I have running process and I need to continue this process, then how to get process instance id ? If I have a variable in my process, for example  proposal id, I  want to know  the  relative process id. Is it possible?

      Could anyone help me?

      Thanks in advice.

      Gianluca

        • 1. Re: restart running process
          Michael Wohlfart Expert

          what do you mean by "restarting"?

          A process instance is started once, pauses in wait-states and terminates in an end-state where do you want to restart a process?

          As for the connection between the business data and the process instance, you can either keep a process instance id in your business data or query the jbpm4 tables with hql depending on the type of your variable.

          1 of 1 people found this helpful
          • 2. Re: restart running process
            gianluc ricciardi Newbie

            Thanks  Michael  4 your response. I Mean "resume" , then I'll do so. I found the way how to   execute query across jbpm tablels.

            Something like this:

             

             

            String pid=processEngine.execute(
                  new Command<String>() {
                     private String id;
                    public String execute(Environment environment) throws Exception {
                      DbSessionImpl dbSessionImpl = environment.get(DbSessionImpl.class);
                      Session session = dbSessionImpl.getSession();
                     
                     
                      List<Variable> list =
                      session.createQuery(
                              "from " + org.jbpm.pvm.internal.type.Variable.class.getName()).list();
                      Variable var = list.get(0);
                      String id_ = var.getExecution().toString();
                    
                      return id_.substring(id_.indexOf("[")+1,id_.indexOf("]"));
                    }
                  }
               );

            String pid=processEngine.execute(

                             new Command<Void>() {

                                private String id;

                               public String execute(Environment environment) throws Exception {

                                 DbSessionImpl dbSessionImpl = environment.get(DbSessionImpl.class);

                                 Session session = dbSessionImpl.getSession();

                                

                                

                                 List<Variable> list =

                                 session.createQuery(

                                         "from " + org.jbpm.pvm.internal.type.Variable.class.getName()).list();

                      

                      

                              ...

                               }

                             }

                          );