7 Replies Latest reply on Apr 25, 2007 12:59 PM by Ronald van Kuijk

    swimlaneInstance overwritten when creating startTaskInstance

    O Y Newbie

      confused in TaskMgmtInstance createStartTaskInstance:

       public TaskInstance createStartTaskInstance() {
       ...
       taskInstance.setActorId(SecurityHelper.getAuthenticatedActorId());
       return taskInstance;
       }
      


      this will overwrite any (if there is any) initialized swimlaneInstances related to this taskInstance because:
       /**
       * (re)assign this task to the given actor. If this task is related
       * to a swimlane instance, that swimlane instance will be updated as well.
       */
       public void setActorId(String actorId) {
       setActorId(actorId, true);
       }
      
       /**
       * (re)assign this task to the given actor.
       * @param actorId is reference to the person that is assigned to this task.
       * @param overwriteSwimlane specifies if the related swimlane
       * should be overwritten with the given swimlaneActorId.
       */
       public void setActorId(String actorId, boolean overwriteSwimlane){
       ...
       }
      


      in our application we have to initialize all swimlaneInstances at processInstance creation time, in order to do reassignment dynamically before the start of a process.

      So would it be better if the code looks like this:
       public TaskInstance createStartTaskInstance() {
       ...
       taskInstance.setActorId(SecurityHelper.getAuthenticatedActorId(), false);
       return taskInstance;
       }