[jboss-user] [jBPM] - How to define multiple users for a process

leod leod do-not-reply at jboss.com
Fri Jan 14 04:08:46 EST 2011


leod leod [http://community.jboss.org/people/leod38] created the discussion

"How to define multiple users for a process"

To view the discussion, visit: http://community.jboss.org/message/580780#580780

--------------------------------------------------------------
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 :

processDefinition.xml

<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="simple">  

    <start-state name="start">  
        <transition name="toStep1" to="step1" />  
    </start-state>

    <task-node name="step1">  
        <task name="step1">  
            <assignment actor-id="toto" />
        </task>  
        <transition name="toStep2" to="step2" />
        <transition name="cancel" to="error" />  
    </task-node>

    <task-node name="step2">  
        <task name="step2">  
            <assignment actor-id="titi" />  
        </task>  
        <transition name="toStep3" to="step3" />  
        <transition name="cancel" to="error" />  
    </task-node>

    <task-node name="step3">  
        <task name="step3">  
            <assignment actor-id="tata" />  
        </task>  
        <transition name="toEnd" to="end" />  
        <transition name="cancel" to="error" />  
    </task-node>

    <end-state name="error"/>  
    <end-state name="end" />

</process-definition>


My page is the fallowing WorkFlow.xhtml

<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a4j="http://richfaces.org/a4j" 
    template="include/template.xhtml">

    <ui:define name="body">
        <ui:include src="/include/menu.xhtml" />

        <h1><h:outputText value="#{MenuBean.currentFormularDescr}"/></h1>

        <h:form>  
               <div>  
                  <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"/>
                      <br/><br/>
                  </a4j:repeat>
               </div>
               <br/><br/>
               <h:commandButton value="Start Process" action="#{orderStock.startProcess}"/>  
        </h:form>

    </ui:define>
</ui:composition>


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;
 
@Name("orderStock")
@Scope(ScopeType.BUSINESS_PROCESS)
public class OrderStock implements Serializable{
 
    private static final long serialVersionUID = -6823728442889976233L;
 
    public String getPercent(String name){
        if(name.equals("step1")){
            return "0%";
        }else if(name.equals("step2")){
            return "33%";
        }else if(name.equals("step3")){
            return "66%";
        }else{
            return "100%";
        }
    }
 
    @CreateProcess(definition="simple")  
    public  void startProcess(){
    }  
 
    @BeginTask
    @EndTask(transition="toStep2")  
    public void doStep1(){}  
 
    @BeginTask 
    @EndTask(transition="toStep3")  
    public void doStep2(){}
 
    @BeginTask  
    @EndTask(transition="toEnd")  
    public void doEnd(){}  
 
    @BeginTask  
    @EndTask(transition="cancel")  
    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

Leod
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/580780#580780]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110114/3e4bfe30/attachment-0001.html 


More information about the jboss-user mailing list