4 Replies Latest reply on Nov 20, 2008 10:33 AM by kukeltje

    ActorID and swimlane for a Task instance

      Hi ,
      In my application i need to insert both Actor id as well as swimlane for a taskinstance whenever it is created.Because the logged in user views his tasks in myworkitem page and in group workitem he will be viewing the group workitem tasks. So for Myworkitem i will retrive based on ActorId and for group workitem i will retrive based on swimlane instance.

      My JPDL :Contains
      ----------------------

      For swimlane i have given swimlane Tag as
      --------------------------------------------------


      <assignment pooled-actors="AD,GSM,RVP,DVP,CDM"/>



      For the actorId setting i have used .. Event tag with task-create attribute. where i am doing the following code


      My Sample Task Node in my JPDL
      ---------------------------------------
      <task-node name="RateCard AD Approval">






      </task-node>



      public class MyHandlerClass implements ActionHandler
      {
      private static final long serialVersionUID = 1L;

      public void execute(ExecutionContext poExecutionContext) throws Exception {
      System.out.println("Assigning the Task to the User");
      JbpmContext jbpmContext = poExecutionContext.getJbpmContext();
      long taskId = poExecutionContext.getTaskInstance().getId();
      System.out.println("Task Instance ID IS ::::::::: "+taskId);
      TaskInstance taskInstance = jbpmContext.getTaskInstance(taskId);
      taskInstance.setActorId("AD");
      jbpmContext.save(taskInstance);
      System.out.println("Task Instance ACTOR ID::::::::: "+poExecutionContext.getTaskInstance().getActorId());
      System.out.println("Assigning Done");
      }
      }




      The Problem is when i remove the swimlane from Process Defintion it sets the Actor id in taskInstance table. but when i try with swimlane it either sets the actor iD but removes the swimlaneInstance .

      WHY do we not have provision to set both while task instantiated...

      Kindly reply as soon as possible.

        • 1. Re: ActorID and swimlane for a Task instance
          kukeltje

          2 things:

          - use [ c o d e ] tags (see preview)
          - make a real unit test with embedded processdefinition and actionhandler so we can easilty try it an maybe find a quick solution

          • 2. Re: ActorID and swimlane for a Task instance

            I tried with Action Handler but it works within the execution context but it doesnt persist the same in The TaskInstance table. The sample handler i have placed for your view in this section itself...
            Kindly have alook.

            The First option you opted is not clear to me. can you explain a bit more in this.

            • 3. Re: ActorID and swimlane for a Task instance

              Hi Ronald,
              I tried to call a method from my business object to set the actor ID by passing the taskInstance which was created with a swimlaneInstance. At this way the the ActorId gets persisted in the taskInstance table. But For me this is not the case that i want i actually assign both ActorId and swimlaneInstance while task creation itself. but i think JBPM doesnt allow both to be persistd with one session at a time.


              Kindly let me know if you have a solution to solve this.

              • 4. Re: ActorID and swimlane for a Task instance
                kukeltje

                I want to help you but please.... do this:

                "Kukeltje" wrote:

                - make a real unit test with embedded processdefinition and actionhandler so we can easilty try it an maybe find a quick solution