public boolean isStartTaskInstance() {
   boolean isStartTaskInstance = false;
   if ((taskMgmtInstance != null) && (taskMgmtInstance.getTaskMgmtDefinition() != null)) {
     isStartTaskInstance =
         ((task != null)
             && (task.equals(taskMgmtInstance.getTaskMgmtDefinition().getStartTask())));
   }
   return isStartTaskInstance;
 }
  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);
  }
 public boolean isLast() {
   return ((token != null)
       && (taskMgmtInstance != null)
       && (!taskMgmtInstance.hasUnfinishedTasks(token)));
 }