/* (non-Javadoc) * @see org.fireflow.engine.IProcessInstance#run() */ public void run() throws EngineException, KernelException { if (this.getState().intValue() != IProcessInstance.INITIALIZED) { 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开始 }