5 Replies Latest reply on Apr 1, 2009 3:39 PM by Tamas Kohalmi

    How to reassign from group to actor using CommandService?

    Tamas Kohalmi Newbie

      Hello,

      I am a new user of jBPM. Currently, I am creating ZK pages and accessing the jBPM engine through the CommandService interface in JNDI.

      So far I have been able to create process instances, start tasks and generally navigate workflows with success.
      However, I cannot find a way to reassign a task from the pool to an individual actor. I am missing the boat somehow probably.

      Thanks,
      Tamas

        • 1. Re: How to reassign from group to actor using CommandService
          Tamas Kohalmi Newbie

          I forgot to mention that trying to set the actor Id on a TaskInstance fails with the LazyInitializationException. Is the session closing immediately after the GetTaskListCommand normal?

          11:10:25,977 ERROR [LazyInitializationException] failed to lazily initialize a collection of role: org.jbpm.taskmgmt.def.Task.events, no session or session was closed
          org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.jbpm.taskmgmt.def.Task.events, no session or session was closed

          • 2. Re: How to reassign from group to actor using CommandService
            Tamas Kohalmi Newbie

            Here is some code I was trying:

            // Get context.
            InitialContext ic = new InitialContext();

            // Find the command service bean.
            rcs = (RemoteCommandServiceHome) ic.lookup("ejb/CommandServiceBean");

            // Create a new process instance.
            StartProcessInstanceCommand newProcessInstance = new StartProcessInstanceCommand();
            newProcessInstance.setProcessName("CreateDevice");
            newProcessInstance.setStartTransitionName("start");
            newProcessInstance.setActorId("ffvnqb");

            // Set process variables.
            newProcessInstance.setVariables(varMap);
            ProcessInstance procInst = (ProcessInstance) rcs.create().execute(newProcessInstance);
            Long processId = procInst.getId();
            System.out.println("Process Id: " + processId);

            long taskInstanceId = 0;

            // Get task list. Include task variables.
            GetTaskListCommand taskListCommand = new GetTaskListCommand("admin",true);
            List taskInstanceList = (List) rcs.create().execute(taskListCommand);
            for (TaskInstance task : taskInstanceList) {

            System.out.println("Task Name: " + task.getName());
            System.out.println("Task Instance Id: " + task.getId());
            System.out.println("Original Task Assignment: " + task.getActorId());
            taskInstanceId = task.getId();
            }

            //
            StartWorkOnTaskCommand startTaskCommand = new StartWorkOnTaskCommand(taskInstanceId, true);
            rcs.create().execute(startTaskCommand);

            • 4. Re: How to reassign from group to actor using CommandService
              Ronald van Kuijk Master

               

              Is the session closing immediately after the GetTaskListCommand normal?


              Yes

              • 5. Re: How to reassign from group to actor using CommandService
                Tamas Kohalmi Newbie

                 

                "kukeltje" wrote:
                Is the session closing immediately after the GetTaskListCommand normal?

                Yes


                That makes sense. Through RMI/IIOP cannot have a session open.

                GOOD NEWS!!!
                So I just compared the source code of the org.jbpm.command packages, and found that the actorId cannot be set on the StartWorkOnTaskCommand in version 3.2.4.GA.

                Fortunately, in version 3.2.6.SP1 the method to set the actorId IS present.
                Hopefully it is a smooth upgrade.

                Thanks,
                Tamas