Package org.fireflow.kernel

Examples of org.fireflow.kernel.INetInstance


            throw new EngineException(this.getId(),
                    this.getWorkflowProcess(),
                    this.getProcessId(), "The state of the process instance is " + this.getState() + ",can not run it ");
        }

        INetInstance netInstance = rtCtx.getKernelManager().getNetInstance(this.getProcessId(), this.getVersion());
        if (netInstance == null) {
            throw new EngineException(this.getId(),
                    this.getWorkflowProcess(),
                    this.getProcessId(), "The net instance for the  workflow process [Id=" + this.getProcessId() + "] is Not found");
        }
        //触发事件
        ProcessInstanceEvent event = new ProcessInstanceEvent();
        event.setEventType(ProcessInstanceEvent.BEFORE_PROCESS_INSTANCE_RUN);
        event.setSource(this);
        this.fireProcessInstanceEvent(event);

        this.setState(IProcessInstance.RUNNING);
        this.setStartedTime(rtCtx.getCalendarService().getSysDate());
        rtCtx.getPersistenceService().saveOrUpdateProcessInstance(this);
        netInstance.run(this);//运行工作流网实例,从startnode开始
    }
View Full Code Here


          process, taskInstance.getTaskId(), "与activityId="
              + taskInstance.getActivityId()
              + "对应的token.alive=false,因此无法完成complete操作");
    }

    INetInstance netInstance = rtCtx.getKernelManager().getNetInstance(
        taskInstance.getProcessId(), taskInstance.getVersion());
    Object obj = netInstance.getWFElementInstance(taskInstance
        .getActivityId());
    if (obj == null) {
      WorkflowProcess process = taskInstance.getWorkflowProcess();
      throw new EngineException(taskInstance.getProcessInstanceId(),
          process, taskInstance.getTaskId(), "系统没有找到与activityId="
View Full Code Here

            taskInstance.getTaskId(),
            "Jumpto refused because of the current activitgy and the target activity are NOT in the same 'Execution Thread'.");
      }
    }

    INetInstance netInstance = rtCtx.getKernelManager().getNetInstance(
        workflowProcess.getId(), taskInstance.getVersion());
    IActivityInstance targetActivityInstance = (IActivityInstance) netInstance
        .getWFElementInstance(targetActivityId);

    IActivityInstance thisActivityInstance = (IActivityInstance) netInstance
        .getWFElementInstance(taskInstance.getActivityId());
    if (thisActivityInstance == null) {
      WorkflowProcess process = taskInstance.getWorkflowProcess();
      throw new EngineException(taskInstance.getProcessInstanceId(),
          process, taskInstance.getTaskId(), "系统没有找到与activityId="
View Full Code Here

//            taskInstance.getTaskId(),
//            "Jumpto refused because of the current activitgy and the target activity are NOT in the same 'Execution Thread'.");
//      }
    }

    INetInstance netInstance = rtCtx.getKernelManager().getNetInstance(
        workflowProcess.getId(), thisTaskInst.getVersion());
    IActivityInstance targetActivityInstance = null;
    if (targetActivityId!=null){
      targetActivityInstance = (IActivityInstance) netInstance
        .getWFElementInstance(targetActivityId);
    }

    IActivityInstance thisActivityInstance = (IActivityInstance) netInstance
        .getWFElementInstance(thisTaskInst.getActivityId());
    if (thisActivityInstance == null) {
      WorkflowProcess process = thisTaskInst.getWorkflowProcess();
      throw new EngineException(thisTaskInst.getProcessInstanceId(),
          process, thisTaskInst.getTaskId(), "系统没有找到与activityId="
View Full Code Here

            thisTaskInst.getTaskId(),
            "Jumpto refused because of current activity instance can NOT be completed. some task instance of this activity instance is in runing state or initialized state");
      }
    }

    INetInstance netInstance = rtCtx.getKernelManager().getNetInstance(
        workflowProcess.getId(),
        workItem.getTaskInstance().getVersion());
    if (netInstance == null) {
      throw new EngineException(thisTaskInst.getProcessInstanceId(),
          thisTaskInst.getWorkflowProcess(),
          thisTaskInst.getTaskId(),
          "Not find the net instance for workflow process [id="
              + workflowProcess.getId() + ", version="
              + workItem.getTaskInstance().getVersion() + "]");
    }
    Object obj = netInstance.getWFElementInstance(targetActivityId);
    IActivityInstance targetActivityInstance = (IActivityInstance) obj;
    if (targetActivityInstance == null) {
      throw new EngineException(thisTaskInst.getProcessInstanceId(),
          thisTaskInst.getWorkflowProcess(),
          thisTaskInst.getTaskId(),
View Full Code Here

      }
    }

    //所有检查结束,开始执行跳转操作
   
    INetInstance netInstance = rtCtx.getKernelManager().getNetInstance(
        workflowProcess.getId(),
        workItem.getTaskInstance().getVersion());
    if (netInstance == null) {
      throw new EngineException(thisTaskInst.getProcessInstanceId(),
          thisTaskInst.getWorkflowProcess(),
          thisTaskInst.getTaskId(),
          "Not find the net instance for workflow process [id="
              + workflowProcess.getId() + ", version="
              + workItem.getTaskInstance().getVersion() + "]");
    }
    Object obj = netInstance.getWFElementInstance(targetActivityId);
    IActivityInstance targetActivityInstance = (IActivityInstance) obj;
    if (targetActivityInstance == null) {
      throw new EngineException(thisTaskInst.getProcessInstanceId(),
          thisTaskInst.getWorkflowProcess(),
          thisTaskInst.getTaskId(),
View Full Code Here

        }
      }
    }
    // 恢复所有的FromTaskInstance
    INetInstance netInstance = rtCtx.getKernelManager().getNetInstance(
        workflowProcess.getId(),
        workItem.getTaskInstance().getVersion());
    if (netInstance == null) {
      throw new EngineException(thisTaskInstance.getProcessInstanceId(),
          thisTaskInstance.getWorkflowProcess(), thisTaskInstance
              .getTaskId(),
          "Not find the net instance for workflow process [id="
              + workflowProcess.getId() + ", version="
              + workItem.getTaskInstance().getVersion() + "]");
    }

    // 执行reject操作。

    IWorkflowSession session = ((IWorkflowSessionAware) workItem)
        .getCurrentWorkflowSession();
    session.setWithdrawOrRejectOperationFlag(true);
    int newStepNumber = thisTaskInstance.getStepNumber() + 1;
    try {
      // 首先将本WorkItem和TaskInstance cancel掉。
      workItem.setComments(comments);
      ((WorkItem) workItem).setState(IWorkItem.CANCELED);
      ((WorkItem) workItem).setEndTime(rtCtx.getCalendarService()
          .getSysDate());
      rtCtx.getPersistenceService().saveOrUpdateWorkItem(workItem);

      persistenceService.abortTaskInstance(thisTaskInstance);

      // 删除本环节的token
      persistenceService.deleteTokensForNode(thisTaskInstance
          .getProcessInstanceId(), thisTaskInstance.getActivityId());

      IActivityInstance fromActivityInstance = null;
      for (int i = 0; i < fromActivityIdList.size(); i++) {
        String fromActivityId = (String) fromActivityIdList.get(i);
        Object obj = netInstance.getWFElementInstance(fromActivityId);
        fromActivityInstance = (IActivityInstance) obj;
        Token newToken = new Token();
        ((Token) newToken).setAlive(true);
        ((Token) newToken).setNodeId(fromActivityId);
        newToken.setProcessInstanceId(thisTaskInstance
View Full Code Here

                + targetTaskInstanceTmp.getActivityId()
                + "] are not in 'Initialized' state");
      }
    }

    INetInstance netInstance = rtCtx.getKernelManager().getNetInstance(
        thisTaskInstance.getProcessId(),
        workItem.getTaskInstance().getVersion());
    if (netInstance == null) {
      throw new EngineException(thisTaskInstance.getProcessInstanceId(),
          thisTaskInstance.getWorkflowProcess(), thisTaskInstance
              .getTaskId(),
          "Withdraw operation failed.Not find the net instance for workflow process [id="
              + thisTaskInstance.getProcessId() + ", version="
              + workItem.getTaskInstance().getVersion() + "]");
    }
    Object obj = netInstance.getWFElementInstance(thisTaskInstance
        .getActivityId());
    IActivityInstance thisActivityInstance = (IActivityInstance) obj;

    // 一切检查通过之后进行“收回”处理
View Full Code Here

TOP

Related Classes of org.fireflow.kernel.INetInstance

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.