11 Replies Latest reply on May 20, 2008 4:53 PM by Felipe Fornachari

    swimlane task assignment in process definition not working

    jeffcwang Newbie

      Hello,

      I searched the forum and couldn't find any answer. I have created a new process definition (based on the websale example) along with tasks and forms. However, when I try to assign an actor to a task via a swimlane, it doesn't work. The assigned actor is always "manager", even when i specify the actor to be "shipper" or "programmer" (I added it to the jbpm_user table in db). I checked out the database and the actor_id is correct in jbpm_swimlane table; however in the jbpm_swimlaneinstance table, it is mysteriously always the manager actor id. I am using JBPM 3.2.1.


      Two questions:


      (1) Why is assignment not working?
      (2) Does assignment even matter? In the websale example, I can login as any user and do the tasks, even when assigned to a different person.

      Here is the process def code:

      
      
      <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="cb_9_1">
      
      
       <!-- SWIMLANES (= process roles) -->
       <swimlane name="programmer">
       <assignment actor-id="programmer" />
       </swimlane>
      
       <swimlane name="accountant">
       <assignment actor-id="shipper" />
       </swimlane>
      
       <start-state name="formatting">
       <task swimlane="programmer" />
       <transition to="clean-up"></transition>
       </start-state>
      
       <task-node name="clean-up">
       <task swimlane="accountant" />
       <transition to="create seed list"></transition>
       </task-node>
      
       <task-node name="create seed list">
       <task swimlane="accountant" />
       <transition to="END"></transition>
       </task-node>
      
      
       <end-state name="END"></end-state>
      
      
      </process-definition>
      
      


        • 1. Re: swimlane task assignment in process definition not worki
          jeffcwang Newbie

          I found a workaround for this problem. It seems that there is a bug here. If you have a task in the start-state and try to assign it via a swimlane, it will create a swimlane instance that always maps to "manager". For example, if the swimlane name is "shipper" and the actor_id is "shipper in the jbpm_swimlane table, after being invoked in the start-state it will create a swinlane_instance that maps from shipper to manager. All subsequence usage of the shipper swimlane will be assigned to manager. The solution was to create a start-state that does nothing but transition to a task-node with the first task (as opposed to using the start-state for the first take) because assignment in task-nodes seems to be working correctly.


          • 2. Re: swimlane task assignment in process definition not worki
            Ronald van Kuijk Master

            starttasks cannot be assigned via a swimlane.... they are always assigned to the actor who starts the task and this actor is put in the swimlane related to the task.

            This is by design. If you think it should be different, look in the jira if there is already an issue for this and vote for it. If not, create one and see what the outcome will be (it can be rejected, but I hope it will not be)

            • 3. Re: swimlane task assignment in process definition not worki
              Andreas Schienagel Newbie

              A possible way is to define the first node in the process with the initial command. Then you don't have to use a start-state. I think it should fits yor needs.

              <process-definition name="ProcessName" initial="NodeName">
              

              I never tried this solution, so correct me if i am wrong.

              • 4. Re: swimlane task assignment in process definition not worki
                Andreas Schienagel Newbie

                This unit test shows the use of initial.

                ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
                 "<process-definition" +
                 " xmlns='' name='test' initial='task1'>" +
                 " <task-node name='task1'>" +
                 " <task name='task1'>" +
                 " </task>" +
                 " <transition name='' to='end1'></transition>" +
                 " </task-node>" +
                 " <end-state name='end1'></end-state>" +
                 "</process-definition>"
                 );
                
                 ProcessInstance processInstance = new ProcessInstance(processDefinition);
                
                 Token token = processInstance.getRootToken();
                
                 assertSame(processDefinition.getNode("task1"), token.getNode());


                • 6. Re: swimlane task assignment in process definition not worki
                  Felipe Fornachari Newbie

                  I am having the same problem, and I could not fix it doing what jeffcwang said.

                  I am using JBoss jBPM 3.2.2. When I execute the websale example the swimlane task assignment don't work well.
                  I am runing the websale using jBPM Console Administrator, when I run the websale example, show in the tasks table "Assigned To manager" for example, but all users can see and modify the open task.

                  I created a very simple process, in this process There are 4 tasks and I generated a form for each task, like the code below (file forms.xml):

                  <?xml version="1.0" encoding="UTF-8"?>
                  
                  <forms>
                   <form task="criar" form="criar.xhtml"/>
                   <form task="preencher" form="preencher.xhtml"/>
                   <form task="aprovar" form="aprovar.xhtml"/>
                   <form task="relatorio" form="relatorio.xhtml"/>
                  </forms>



                  Each task was assigned for one user, using swimlane, like the code below (processdefinition.xml):

                  <?xml version="1.0" encoding="UTF-8"?>
                  
                  <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="request">
                  
                  
                   <swimlane name="gerente">
                   <assignment actor-id="admin"></assignment>
                   </swimlane>
                  
                   <swimlane name="funcionario">
                   <assignment actor-id="manager"></assignment>
                   </swimlane>
                  
                   <swimlane name="usuario">
                   <assignment actor-id="user"></assignment>
                   </swimlane>
                  
                  
                   <start-state name="Funcionario Envia Documento">
                   <task name="criar"></task>
                   <transition to="Usuario Assina e Preenche"></transition>
                   </start-state>
                  
                  
                   <task-node name="Usuario Assina e Preenche">
                   <task swimlane="usuario" name="preencher"></task>
                   <transition to="Gerente Confere e Valida"></transition>
                   </task-node>
                  
                   <task-node name="Gerente Confere e Valida">
                   <task name="aprovar" swimlane="gerente"></task>
                   <transition to="Funcionario Recebe Documento" name="Aprovado"></transition>
                   <transition to="Usuario Assina e Preenche" name="Nao Aprovado"></transition>
                   </task-node>
                  
                   <task-node name="Funcionario Recebe Documento">
                   <task name="relatorio" swimlane="funcionario"></task>
                   <transition to="Fim"></transition>
                   </task-node>
                  
                  
                   <end-state name="Fim"></end-state>
                  
                  </process-definition>


                  Only the first task was not assigned for anyone, like jeffcwang said.
                  I did not implemented nothig with java, I just did like I said and generate 4 forms: criar.xhtml, preencher.xhtml, aprovar.xhtml and relatorio.xhtml. Only xml and xhtml files.
                  The process work well in the jBPM Console Admin but the swimlane task assignment don'tt work. Like in the websale example, in the tasks table appear, for example, "Assigned To admin", but any kind of user can modify the task.

                  Any idea? I am very new with jBPM, am I forgeting something? I need to do some java implementation in this case, like a actionhandler?

                  Thank you in advance!


                  • 7. Re: swimlane task assignment in process definition not worki
                    Ronald van Kuijk Master

                    known issue in the current webconsole..... afaik it is fixed in the cvs head version

                    • 8. Re: swimlane task assignment in process definition not worki
                      Felipe Fornachari Newbie

                       

                      "kukeltje" wrote:
                      known issue in the current webconsole..... afaik it is fixed in the cvs head version



                      Sorry kukeltje, but I am using the last jBPM version, the 3.2.2 version, as you can see here http://www.jboss.org/jbossjbpm/jbpm_downloads/.
                      I didn't understand very well you message.

                      Any other idea?

                      • 9. Re: swimlane task assignment in process definition not worki
                        Varun Doda Newbie

                        I am having the same problem.
                        kukeltje, can you explain what solution you have provided?

                        • 10. Re: swimlane task assignment in process definition not worki
                          Felipe Fornachari Newbie


                          I tried all ways to assign an actor to a task, not only using swimlanes, but directely from the task selecting a task-node-> then selecting the task in the properties menu-> then clicking in "assignment" and selecting "actor" and entering with a valid user, but didn't work too.

                          Please, any help? Any idea?
                          I need to do this, and I think that is a thing very simple in jBPM, this should be working!

                          Thank in advance!




                          • 11. Re: swimlane task assignment in process definition not worki
                            Felipe Fornachari Newbie

                            SOLUTION HERE:

                            http://jira.jboss.com/jira/browse/JBPM-1022?actionOrder=asc

                            Read Sebastian's comment:
                            I might be wrong,
                            but isn't it possible to easily fix it by changing the line in tasks.xhtml :
                            <j4j:listTasks includeEnded="true" target="#{tasks}"/>
                            by this one:
                            <j4j:listTasksForActor actorId="#{request.remoteUser}" target="#{tasks}"/>
                            ?

                            I tried this and it's work!

                            Thank to all!