Пример #1
0
  /**
   * (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) {
    // do the actual assignment
    this.previousActorId = this.actorId;
    this.actorId = actorId;
    if ((swimlaneInstance != null) && (overwriteSwimlane)) {
      log.debug("assigning task '" + name + "' to '" + actorId + "'");
      swimlaneInstance.setActorId(actorId);
    }

    // fire the event
    if ((task != null) && (token != null)) {
      ExecutionContext executionContext = new ExecutionContext(token);
      executionContext.setTask(task);
      executionContext.setTaskInstance(this);
      task.fireEvent(Event.EVENTTYPE_TASK_ASSIGN, executionContext);
    }

    // add the log
    if (token != null) {
      // log this assignment
      token.addLog(new TaskAssignLog(this, previousActorId, actorId));
    }
  }
Пример #2
0
  public void assign(ExecutionContext executionContext) {
    TaskMgmtInstance taskMgmtInstance = executionContext.getTaskMgmtInstance();

    Swimlane swimlane = task.getSwimlane();
    // if this task is in a swimlane
    if (swimlane != null) {

      // if this is a task assignment for a start-state
      if (isStartTaskInstance()) {
        // initialize the swimlane
        swimlaneInstance = new SwimlaneInstance(swimlane);
        taskMgmtInstance.addSwimlaneInstance(swimlaneInstance);
        // with the current authenticated actor
        swimlaneInstance.setActorId(SecurityHelper.getAuthenticatedActorId());

      } else {

        // lazy initialize the swimlane...
        // get the swimlane instance (if there is any)
        swimlaneInstance =
            taskMgmtInstance.getInitializedSwimlaneInstance(executionContext, swimlane);

        // copy the swimlaneInstance assignment into the taskInstance assignment
        copySwimlaneInstanceAssignment(swimlaneInstance);
      }

    } else { // this task is not in a swimlane
      taskMgmtInstance.performAssignment(
          task.getAssignmentDelegation(),
          task.getActorIdExpression(),
          task.getPooledActorsExpression(),
          this,
          executionContext);
    }

    updatePooledActorsReferences(swimlaneInstance);
  }
Пример #3
0
 /**
  * copies the assignment (that includes both the swimlaneActorId and the set of pooledActors) of
  * the given swimlane into this taskInstance.
  */
 public void copySwimlaneInstanceAssignment(SwimlaneInstance swimlaneInstance) {
   setSwimlaneInstance(swimlaneInstance);
   setActorId(swimlaneInstance.getActorId());
   setPooledActors(swimlaneInstance.getPooledActors());
 }