0 Replies Latest reply on Jan 14, 2011 4:08 AM by leod leod

    How to define multiple users for a process

    leod leod Newbie

      Hello all,


      I try to develop an exemple of multiple users for ending a process

      I want to start a process

      doing step1 by toto

      doing step2 by titi

      ending process with tata


      Here its my current code :




      <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="simple">  
          <start-state name="start">  
              <transition name="toStep1" to="step1" />  
          <task-node name="step1">  
              <task name="step1">  
                  <assignment actor-id="toto" />
              <transition name="toStep2" to="step2" />
              <transition name="cancel" to="error" />  
          <task-node name="step2">  
              <task name="step2">  
                  <assignment actor-id="titi" />  
              <transition name="toStep3" to="step3" />  
              <transition name="cancel" to="error" />  
          <task-node name="step3">  
              <task name="step3">  
                  <assignment actor-id="tata" />  
              <transition name="toEnd" to="end" />  
              <transition name="cancel" to="error" />  
          <end-state name="error"/>  
          <end-state name="end" />


      My page is the fallowing WorkFlow.xhtml


          <ui:define name="body">
              <ui:include src="/include/menu.xhtml" />
              <h1><h:outputText value="#{MenuBean.currentFormularDescr}"/></h1>
                        <h:outputText value="There are no process started for the moment" rendered="#{empty taskInstancePriorityList}"/>
                        <a4j:repeat value="#{taskInstancePriorityList}" var="task" rendered="#{not empty taskInstancePriorityList}">
                            <h:outputText value="Process created by #{actor.id} at #{task.taskMgmtInstance.processInstance.start}"/>
                            <br/><h:outputText styleClass="ml30" value="STATUS : #{task.name} Progress : #{orderStock.getPercent(task.name)}"/>
                            <br/><s:button styleClass="ml30" action="#{orderStock.doStep1}" taskInstance="#{task}" value="DoStep1"/>
                                 <s:button styleClass="ml30" action="#{orderStock.doStep2}" taskInstance="#{task}" value="DoStep2"/>
                                 <s:button styleClass="ml30" action="#{orderStock.doEnd}" taskInstance="#{task}" value="DoEnd"/>
                                 <s:button styleClass="ml30" action="#{orderStock.cancel}" taskInstance="#{task}" value="Cancel"/>
                     <h:commandButton value="Start Process" action="#{orderStock.startProcess}"/>  


      And OrderStock.java looks like this :


      package com.ste.crw.jbpm;
      import java.io.Serializable;
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.bpm.BeginTask;
      import org.jboss.seam.annotations.bpm.CreateProcess;  
      import org.jboss.seam.annotations.bpm.EndTask;  
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      public class OrderStock implements Serializable{
          private static final long serialVersionUID = -6823728442889976233L;
          public String getPercent(String name){
                  return "0%";
              }else if(name.equals("step2")){
                  return "33%";
              }else if(name.equals("step3")){
                  return "66%";
                  return "100%";
          public  void startProcess(){
          public void doStep1(){}  
          public void doStep2(){}
          public void doEnd(){}  
          public void cancel(){}  


      The beginning works fine

      I Create the process , and when i'm log on website with login "toto", I see the process


      but when i push on "DoStep1" button i have the following error :


      javax.el.ELException: java.lang.IllegalStateException: begin method invoked from a long-running conversation, try using @Begin(joi
      n=true) on method: doStep1


      Where is the problem ?

      I'm a begginner with JBPM and Seam , and documentation is not easy to understand

      I use : JBPM 3.2.7 and Seam 2.1.2


      Thanks in advance for your help