Package org.fireflow.model

Examples of org.fireflow.model.Task


    ((TaskInstance) taskInstance).setStartedTime(this.rtCtx
        .getCalendarService().getSysDate());
    this.rtCtx.getPersistenceService().saveOrUpdateTaskInstance(
        taskInstance);

    Task task = taskInstance.getTask();
    String taskInstanceRunnerName = null;
    ITaskInstanceRunner taskInstanceRunner = null;

    String taskType = task.getType();

    taskInstanceRunnerName = task.getTaskInstanceRunner();
    if (taskInstanceRunnerName != null
        && !taskInstanceRunnerName.trim().equals("")) {
      IBeanFactory beanFactory = this.rtCtx.getBeanFactory();
      taskInstanceRunner = (ITaskInstanceRunner) beanFactory
          .getBean(taskInstanceRunnerName);
    }

    if (taskInstanceRunner == null) {
      if (Task.FORM.equals(taskType)) {
        taskInstanceRunnerName = processInstance.getWorkflowProcess()
            .getFormTaskInstanceRunner();
      } else if (Task.TOOL.equals(taskType)) {
        taskInstanceRunnerName = processInstance.getWorkflowProcess()
            .getToolTaskInstanceRunner();
      } else if (Task.SUBFLOW.equals(taskType)) {
        taskInstanceRunnerName = processInstance.getWorkflowProcess()
            .getSubflowTaskInstanceRunner();
      }
      if (taskInstanceRunnerName != null
          && !taskInstanceRunnerName.trim().equals("")) {
        IBeanFactory beanFactory = this.rtCtx.getBeanFactory();
        taskInstanceRunner = (ITaskInstanceRunner) beanFactory
            .getBean(taskInstanceRunnerName);
      }
    }

    if (taskInstanceRunner == null) {
      if (Task.FORM.equals(taskType)) {
        taskInstanceRunner = defaultFormTaskInstanceRunner;
      } else if (Task.TOOL.equals(taskType)) {
        taskInstanceRunner = defaultToolTaskInstanceRunner;
      } else if (Task.SUBFLOW.equals(taskType)) {
        taskInstanceRunner = defaultSubflowTaskInstanceRunner;
      }
    }
    if (taskInstanceRunner != null) {
      taskInstanceRunner.run(currentSession, this.rtCtx, processInstance,
          taskInstance);
    } else {
      WorkflowProcess process = taskInstance.getWorkflowProcess();
      throw new EngineException(taskInstance.getProcessInstanceId(),
          process, taskInstance.getTaskId(),
          "无法获取TaskInstanceRunner,TaskId=" + task.getId()
              + ", taskType=" + taskInstance.getTaskType());
    }
  }
View Full Code Here


   */
  protected final boolean taskInstanceCanBeCompleted(
      IWorkflowSession currentSession, RuntimeContext runtimeContext,
      IProcessInstance processInstance, ITaskInstance taskInstance)
      throws EngineException, KernelException {
    Task task = taskInstance.getTask();
    String taskInstanceCompletionEvaluatorName = null;
    ITaskInstanceCompletionEvaluator taskInstanceCompletionEvaluator = null;

    String taskType = task.getType();

    taskInstanceCompletionEvaluatorName = task
        .getTaskInstanceCompletionEvaluator();
    if (taskInstanceCompletionEvaluatorName != null
        && !taskInstanceCompletionEvaluatorName.trim().equals("")) {
      IBeanFactory beanFactory = runtimeContext.getBeanFactory();
      taskInstanceCompletionEvaluator = (ITaskInstanceCompletionEvaluator) beanFactory
          .getBean(taskInstanceCompletionEvaluatorName);
    }

    if (taskInstanceCompletionEvaluator == null) {
      if (Task.FORM.equals(taskType)) {
        taskInstanceCompletionEvaluatorName = processInstance
            .getWorkflowProcess()
            .getFormTaskInstanceCompletionEvaluator();
      } else if (Task.TOOL.equals(taskType)) {
        taskInstanceCompletionEvaluatorName = processInstance
            .getWorkflowProcess()
            .getToolTaskInstanceCompletionEvaluator();
      } else if (Task.SUBFLOW.equals(taskType)) {
        taskInstanceCompletionEvaluatorName = processInstance
            .getWorkflowProcess()
            .getSubflowTaskInstanceCompletionEvaluator();
      }
      if (taskInstanceCompletionEvaluatorName != null
          && !taskInstanceCompletionEvaluatorName.trim().equals("")) {
        IBeanFactory beanFactory = runtimeContext.getBeanFactory();
        taskInstanceCompletionEvaluator = (ITaskInstanceCompletionEvaluator) beanFactory
            .getBean(taskInstanceCompletionEvaluatorName);
      }
    }

    if (taskInstanceCompletionEvaluator == null) {
      if (Task.FORM.equals(taskType)) {
        taskInstanceCompletionEvaluator = this.defaultFormTaskInstanceCompletionEvaluator;
      } else if (Task.TOOL.equals(taskType)) {
        taskInstanceCompletionEvaluator = this.defaultToolTaskInstanceCompletionEvaluator;
      } else if (Task.SUBFLOW.equals(taskType)) {
        taskInstanceCompletionEvaluator = this.defaultSubflowTaskInstanceCompletionEvaluator;
      }
    }
    if (taskInstanceCompletionEvaluator != null) {
      return taskInstanceCompletionEvaluator.taskInstanceCanBeCompleted(
          currentSession, runtimeContext, processInstance,
          taskInstance);
    } else {
      WorkflowProcess process = taskInstance.getWorkflowProcess();
      throw new EngineException(taskInstance.getProcessInstanceId(),
          process, taskInstance.getTaskId(),
          "无法获取TaskInstanceCompletionEvaluator,TaskId="
              + task.getId() + ", taskType="
              + taskInstance.getTaskType());
    }
  }
View Full Code Here

   * @param e
   * @throws org.fireflow.engine.EngineException
   */
  protected final void fireTaskInstanceEvent(ITaskInstance taskInstance,
      TaskInstanceEvent e) throws EngineException {
    Task task = taskInstance.getTask();
    if (task == null) {
      return;
    }

    List<EventListener> listeners = task.getEventListeners();
    for (int i = 0; i < listeners.size(); i++) {
      EventListener listener = listeners.get(i);
      Object obj = rtCtx.getBeanByName(listener.getClassName());
      if (obj != null && (obj instanceof ITaskInstanceEventListener)) {
        ((ITaskInstanceEventListener) obj).onTaskInstanceEventFired(e);
View Full Code Here

      String fromActivityId = (String) fromActivityIdList.get(i);
      Activity fromActivity = (Activity) workflowProcess
          .findWFElementById(fromActivityId);
      List<Task> fromTaskList = fromActivity.getTasks();
      for (int j = 0; j < fromTaskList.size(); j++) {
        Task task =  fromTaskList.get(j);
        if (Task.TOOL.equals(task.getType())
            || Task.SUBFLOW.equals(task.getType())) {
          throw new EngineException(
              thisTaskInstance.getProcessInstanceId(),
              thisTaskInstance.getWorkflowProcess(),
              thisTaskInstance.getTaskId(),
              "Reject operation refused!The previous activity contains tool-task or subflow-task");
View Full Code Here

TOP

Related Classes of org.fireflow.model.Task

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.