@Override
public void processStart(ProcessStartEvent event) {
ProcessInstance processInstance = event.getProcessInstance();
ProcessEngine processEngine = event.getProcessEngine();
ProcessElement processXml = event.getProcessXml();
//设置流程实例为运行状态
event.getProcInstFacade().updateProcessStateAndStartTime(processInstance.getProcessInstId(),
StarFlowState.PROCESS_INST_RUNNING, new Date());
//执行流程开始filter
for(ProcessFilter filter : processEngine.getProcessFilters()) {
filter.processStart(event);
}
//流程启动后触发事件
TriggerProcessEventUtil.afterStart(processEngine, null, processInstance,
processXml.getEvents());
StartActivityType type = (StartActivityType)ActivityTypeFactory.buildActivityType(Constants.ACT_TYPE_START);
ActivityElement activityXml = processXml.getActivitys().get(StarFlowNames.ACT_START_ID);
ActivityInst activityInst = type.createActivity(event, activityXml);
EventUtil.publishActivityStartEvent(event, activityInst, activityXml);
}