Package com.starflow.wf.engine

Examples of com.starflow.wf.engine.ProcessEngine


    if(StarFlowState.ACT_INST_RUNING != activityInst.getCurrentState())
      throw new ProcessEngineException("当前环节(activityInstId="+activityInst.getActivityInstId()+")不处于状态,"+
          "无法完成环节的运行!");
   
    Date nowDate = new Date();
    ProcessEngine processEngine = event.getProcessEngine();
    activityInst.setCurrentState(StarFlowState.ACT_INST_COMPLETED);
    activityInst.setEndTime(nowDate);
   
    ProcessElement processXml = event.getProcessXml();
    ActivityElement activityXml = processXml.getActivitys().get(activityInst.getActivityDefId());
    String actType = activityXml.getType();
   
    //判断当前环节是否可以结束
    boolean completeFlag = isCompleteActivity(activityXml, event);
    if(!completeFlag)
      return ;
   
    TriggerActivityEventUtil.beforeComplete(processEngine, activityXml, activityInst, activityXml.getEvents());
   
    //结束当前环节
    event.getActInstRep().updateActivityStateAndEndTime(activityInst.getActivityInstId(),
        activityInst.getCurrentState(), activityInst.getEndTime());
   
    //未完成工作项自动终止
    if(Constants.ACT_TYPE_MANUL.equalsIgnoreCase(actType) && activityXml.getIsAutoCancel())
      event.getWorkItemRep().updateActWorkItemStateAndFinalTime(activityInst.getActivityInstId(), StarFlowState.WORKITEM_STOPPED, nowDate);
   
    //执行环节结束filter
    for(ProcessFilter filter : processEngine.getProcessFilters()) {
      filter.activityComplete(event);
    }
   
    TriggerActivityEventUtil.afterComplete(processEngine, activityXml, activityInst, activityXml.getEvents());
   
View Full Code Here


public class ProcessStartListener extends AbstractProcessListener {

  @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,
View Full Code Here

*/
public class ActivityTerminalListener extends AbstractProcessListener {
 
  @Override
  public void activityTerminal(ActivityTerminalEvent event) {
    ProcessEngine processEngine = event.getProcessEngine();
    ActivityInst activityInst = ((ActivityTerminalEvent)event).getActivityInst();
   
    Date finalTime = new Date();
    event.getWorkItemRep().updateActWorkItemStateAndFinalTime(activityInst.getActivityInstId(), StarFlowState.WORKITEM_STOPPED, finalTime);
    event.getActInstRep().updateActivityStateAndFinalTime(activityInst.getActivityInstId(), StarFlowState.ACT_INST_STOPPED, finalTime);
   
    //执行环节终止filter
    for(ProcessFilter filter : processEngine.getProcessFilters()) {
      filter.activityTerminal(event);
    }
  }
View Full Code Here

*/
public class ProcessTerminalListener extends AbstractProcessListener {
 
  @Override
  public void processTerminal(ProcessTerminalEvent event) {
    ProcessEngine processEngine = event.getProcessEngine();
    ProcessInstance processInstance = event.getProcessInstance();
    long processInstId = processInstance.getProcessInstId();
   
    Date finalTime = new Date();
    event.getWorkItemRep().updateProcWorkItemStateAndFinalTime(processInstId, StarFlowState.WORKITEM_STOPPED, finalTime);
    event.getActInstRep().updateProcActivityStateAndFinalTime(processInstId, StarFlowState.ACT_INST_STOPPED, finalTime);
    event.getProcInstFacade().updateProcessStateAndFinalTime(processInstId, StarFlowState.PROCESS_INST_STOPPED, finalTime);
   
    //执行环节终止filter
    for(ProcessFilter filter : processEngine.getProcessFilters()) {
      filter.processTerminal(event);
    }
  }
View Full Code Here

  IProcessDefineService procDefService;
  IActivityInstService activityInstService;
 
  @Before
  public void init() {
    ProcessEngine processEngine = new ProcessEngineBuilder().buildProcessEngine();
    procDefService = processEngine.getProcessDefineService();
    procInstService = processEngine.getProcessInstanceService();
    workItemService = processEngine.getWorkItemService();
    activityInstService = processEngine.getActivityInstService();
   
    //清除测试数据
    TestUtil.cleanData(processEngine.getApplicationContext());
   
    //添加filter
    processEngine.addFilter(new LoggerProcessFilter());
    processEngine.addFilter(new TransCtrlFilter());
  }
View Full Code Here

TOP

Related Classes of com.starflow.wf.engine.ProcessEngine

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.