Package org.fireflow.engine

Examples of org.fireflow.engine.EngineException


     * @see org.fireflow.engine.taskinstance.ITaskInstanceRunner#run(org.fireflow.engine.IWorkflowSession, org.fireflow.engine.RuntimeContext, org.fireflow.engine.IProcessInstance, org.fireflow.engine.ITaskInstance)
     */
    public void run(IWorkflowSession currentSession, RuntimeContext runtimeContext, IProcessInstance processInstance,
            ITaskInstance taskInstance) throws EngineException, KernelException {
        if (!Task.TOOL.equals(taskInstance.getTaskType())) {
            throw new EngineException(processInstance,
                    taskInstance.getActivity(),
                    "DefaultToolTaskInstanceRunner:TaskInstance的任务类型错误,只能为TOOL类型");
        }
        Task task = taskInstance.getTask();
        if (task == null) {
            WorkflowProcess process = taskInstance.getWorkflowProcess();
            throw new EngineException(taskInstance.getProcessInstanceId(), process,
                    taskInstance.getTaskId(),
                    "The Task is null,can NOT start the taskinstance,");
        }
        if (((ToolTask) task).getApplication() == null || ((ToolTask) task).getApplication().getHandler() == null) {
            WorkflowProcess process = taskInstance.getWorkflowProcess();
            throw new EngineException(taskInstance.getProcessInstanceId(), process,
                    taskInstance.getTaskId(),
                    "The task.getApplication() is null or task.getApplication().getHandler() is null,can NOT start the taskinstance,");
        }

        Object obj = runtimeContext.getBeanByName(((ToolTask) task).getApplication().getHandler());

        if (obj==null || !(obj instanceof IApplicationHandler)){
            WorkflowProcess process = taskInstance.getWorkflowProcess();
            throw new EngineException(taskInstance.getProcessInstanceId(), process,
                    taskInstance.getTaskId(),
                    "Run tool task instance error! Not found the instance of "+((ToolTask) task).getApplication().getHandler()+" or the instance not implements IApplicationHandler");
           
        }

        try {
            ((IApplicationHandler) obj).execute(taskInstance);
        } catch (Exception e) {
            //TODO wmj2003 对tool类型的task抛出的错误应该怎么处理? 这个时候引擎会如何?整个流程是否还可以继续?
          e.printStackTrace();
            throw new EngineException(processInstance,
                    taskInstance.getActivity(),
                    "DefaultToolTaskInstanceRunner:TaskInstance的任务执行失败!");
        }

        ITaskInstanceManager taskInstanceManager = runtimeContext.getTaskInstanceManager();
View Full Code Here


    /* (non-Javadoc)
     * @see org.fireflow.engine.IWorkItem#withdraw()
     */
    public IWorkItem withdraw() throws EngineException, KernelException {
      if (this.workflowSession==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current workflow session is null.");
      }
      if (this.rtCtx==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current runtime context is null.");       
      }     
        ITaskInstanceManager taskInstanceMgr = this.rtCtx.getTaskInstanceManager();
        return taskInstanceMgr.withdrawWorkItem(this);
View Full Code Here

    /* (non-Javadoc)
     * @see org.fireflow.engine.IWorkItem#reject(java.lang.String)
     */
    public void reject(String comments) throws EngineException, KernelException {
      if (this.workflowSession==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current workflow session is null.");
      }
      if (this.rtCtx==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current runtime context is null.");       
      }     
        ITaskInstanceManager taskInstanceMgr = this.rtCtx.getTaskInstanceManager();
        taskInstanceMgr.rejectWorkItem(this,comments);
View Full Code Here

   * @see org.fireflow.engine.IWorkItem#complete(org.fireflow.engine.taskinstance.DynamicAssignmentHandler, java.lang.String)
   */
  public void complete(DynamicAssignmentHandler dynamicAssignmentHandler, String comments)
      throws EngineException, KernelException {
      if (this.workflowSession==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current workflow session is null.");
      }
      if (this.rtCtx==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current runtime context is null.");       
      }

        if (this.getState().intValue() != IWorkItem.RUNNING) {
            TaskInstance thisTaskInst = (TaskInstance) this.getTaskInstance();
//      System.out.println("WorkItem的当前状态为"+this.getState()+",不可以执行complete操作。");
            throw new EngineException(thisTaskInst.getProcessInstanceId(), thisTaskInst.getWorkflowProcess(),
                    thisTaskInst.getTaskId(),
                    "Complete work item failed . The state of the work item [id=" + this.getId() + "] is " + this.getState());
        }     
     
      if (dynamicAssignmentHandler!=null){
View Full Code Here

    /* (non-Javadoc)
     * @see org.fireflow.engine.IWorkItem#reassignTo(java.lang.String, java.lang.String)
     */
    public IWorkItem reassignTo(String actorId, String comments) throws EngineException{
      if (this.workflowSession==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current workflow session is null.");
      }
      if (this.rtCtx==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current runtime context is null.");       
      }
   
        ITaskInstanceManager manager = this.rtCtx.getTaskInstanceManager();
View Full Code Here

    /* (non-Javadoc)
     * @see org.fireflow.engine.IWorkItem#claim()
     */
    public IWorkItem claim() throws EngineException, KernelException {
      if (this.workflowSession==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current workflow session is null.");
      }
      if (this.rtCtx==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current runtime context is null.");       
      }
 
     
View Full Code Here

    /* (non-Javadoc)
     * @see org.fireflow.engine.IWorkItem#jumpTo(java.lang.String, org.fireflow.engine.taskinstance.DynamicAssignmentHandler, java.lang.String)
     */
    public void jumpTo(String targetActivityId, DynamicAssignmentHandler dynamicAssignmentHandler, String comments) throws EngineException, KernelException {
      if (this.workflowSession==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current workflow session is null.");
      }
      if (this.rtCtx==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current runtime context is null.");       
      }
      if (dynamicAssignmentHandler!=null){
        this.workflowSession.setDynamicAssignmentHandler(dynamicAssignmentHandler);
View Full Code Here

    /* (non-Javadoc)
     * @see org.fireflow.engine.IWorkItem#jumpToEx(java.lang.String, org.fireflow.engine.taskinstance.DynamicAssignmentHandler, java.lang.String)
     */
    public void jumpToEx(String targetActivityId, DynamicAssignmentHandler dynamicAssignmentHandler, String comments) throws EngineException, KernelException {
      if (this.workflowSession==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current workflow session is null.");
      }
      if (this.rtCtx==null){
        new EngineException(this.getTaskInstance().getProcessInstanceId(),
            this.getTaskInstance().getWorkflowProcess(),this.getTaskInstance().getTaskId(),
            "The current runtime context is null.");       
      }
      if (dynamicAssignmentHandler!=null){
        this.workflowSession.setDynamicAssignmentHandler(dynamicAssignmentHandler);
View Full Code Here

    IProcessInstance processInstance = token.getProcessInstance();
    WorkflowSession workflowSession = (WorkflowSession) ((IWorkflowSessionAware) processInstance)
        .getCurrentWorkflowSession();

    if (workflowSession == null) {
      throw new EngineException(token.getProcessInstance(),
          activityInstance.getActivity(),
          "The workflow session in process instance can NOT be null");
    }

    int createdTaskInstanceCount = 0;
View Full Code Here

    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

TOP

Related Classes of org.fireflow.engine.EngineException

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.