Package org.jbpm.pvm.internal.task

Examples of org.jbpm.pvm.internal.task.TaskImpl


   
    if (taskId == null || "".equals(taskId)) {
      throw new JbpmException("Cannot complete a task with a null or empty taskId");
    }
   
    TaskImpl task = dbSession.get(TaskImpl.class, Long.parseLong(taskId));
   
    if (task == null) {
      throw new JbpmException("No task with id " + taskId + " was found");
    }
   
    if (outcomeSpecified) {
      task.complete(outcome);
    } else {
      task.complete();
    }
    dbSession.delete(task);
    return null;
  }
View Full Code Here


    this.taskId = taskId;
  }

  public Set<String> execute(Environment environment) {
    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = dbSession.get(TaskImpl.class, Long.parseLong(taskId));
    if (task==null) {
      throw new JbpmException("task "+taskId+" doesn't exist");
    }
   
    Set<String> outcomes = new HashSet<String>();
   
    ExecutionImpl execution = (task!=null ? task.getExecution() : null);
    ActivityImpl activity = (execution!=null ? execution.getActivity() : null);
    List<Transition> outgoingTransitions = (activity!=null ? activity.getOutgoingTransitions() : null);

    if (outgoingTransitions!=null) {
      for (Transition transition: outgoingTransitions) {
View Full Code Here

    this.taskId = taskId;
  }

  public Set<String> execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = dbSession.get(TaskImpl.class, Long.parseLong(taskId));
    return task.getVariableKeys();
  }
View Full Code Here

    this.deleteHistory = deleteHistory;
  }

  public Void execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = (TaskImpl) dbSession.get(TaskImpl.class, taskDbid);
    if (task!=null) {
      task.delete(reason);
      dbSession.delete(task);
      if (deleteHistory) {
        HistoryTaskImpl historyTask = (HistoryTaskImpl) dbSession.get(HistoryTaskImpl.class, taskDbid);
        if (historyTask!=null) {
          dbSession.delete(historyTask);
View Full Code Here

    execute((ExecutionImpl)execution);
  }

  public void execute(ExecutionImpl execution) {
    DbSession dbSession = EnvironmentImpl.getFromCurrent(DbSession.class);
    TaskImpl task = (TaskImpl) dbSession.createTask();
    task.setTaskDefinition(taskDefinition);
    task.setExecution(execution);
    task.setProcessInstance(execution.getProcessInstance());
    task.setSignalling(true);
   
    // initialize the name
    if (taskDefinition.getName()!=null) {
      task.setName(taskDefinition.getName());
    } else {
      task.setName(execution.getActivityName());
    }

    task.setDescription(taskDefinition.getDescription());
    task.setPriority(taskDefinition.getPriority());
    task.setFormResourceName(taskDefinition.getFormResourceName());
   
    // save task so that TaskDbSession.findTaskByExecution works for assign event listeners
    dbSession.save(task);

    SwimlaneDefinitionImpl swimlaneDefinition = taskDefinition.getSwimlaneDefinition();
    if (swimlaneDefinition!=null) {
      SwimlaneImpl swimlane = execution.getInitializedSwimlane(swimlaneDefinition);
      task.setSwimlane(swimlane);
     
      // copy the swimlane assignments to the task
      task.setAssignee(swimlane.getAssignee());
      for (ParticipationImpl participant: swimlane.getParticipations()) {
        task.addParticipation(participant.getUserId(), participant.getGroupId(), participant.getType());
      }
    }

    execution.initializeAssignments(taskDefinition, task);
   
View Full Code Here

    }
   
    execution.fire(signalName, activity);

    DbSession taskDbSession = EnvironmentImpl .getFromCurrent(DbSession.class);
    TaskImpl task = (TaskImpl) taskDbSession.findTaskByExecution(execution);
    task.setSignalling(false);
   
    Transition transition = null;
    List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
   
    if ( (outgoingTransitions!=null) && (!outgoingTransitions.isEmpty()) ) {
View Full Code Here

  public void notify(EventListenerExecution execution) throws Exception {
    // find current task
    EnvironmentImpl environment = EnvironmentImpl.getCurrent();
    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = dbSession.findTaskByExecution(execution);

    // make task available to mail templates through task context
    TaskContext taskContext = new TaskContext(task);
    environment.setContext(taskContext);
    try {
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.internal.task.TaskImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.