Package com.starflow.wf.engine.model

Examples of com.starflow.wf.engine.model.ProcessInstance


    procDefService.deployProcessFile("classpath:flow/StartActSplitExample.xml");
   
    long start = System.currentTimeMillis();
   
    //启动流程
    ProcessInstance processInstance = procInstService.createProcess("flow.StartActSplitExample", "100001");
   
    Map<String, Object> conditions = new HashMap<String, Object>();
    //宽带处理班
    conditions.put("flag", "ADSL");
    RelaDataManager relaDataManager = RelaDataManagerBuilder.buildRelaDataManager();
    long processInstId = processInstance.getProcessInstId();
    String activityDefId = "act_start";
    relaDataManager.setExpressConditions(processInstId, activityDefId, conditions);
   
    //创建流程
    procInstService.startProcess(processInstance.getProcessInstId());
   
    workItemService.finishWorkItem(1l, "100001");
    workItemService.finishWorkItem(2l, "100001");
   
    long end = System.currentTimeMillis();
View Full Code Here


* @version 1.0
*/
public class StartActivityType implements ActivityType {

  public ActivityInst createActivity(AbstractFlowEvent event, ActivityElement activityXml) {
    ProcessInstance procInst = event.getProcessInstance();
   
    ActivityInst activityInst = new ActivityInst();
    activityInst.setActivityDefId(activityXml.getId());
    activityInst.setActivityType(activityXml.getType());
    activityInst.setCurrentState(StarFlowState.ACT_INST_WAITING);
    activityInst.setCreateTime(new Date());
    activityInst.setActivityInstName(activityXml.getName());
    activityInst.setProcessInstId(procInst.getProcessInstId());
   
    long actInstId = PrimaryKeyUtil.getPrimaryKey(Keys.ACTIVITYINSTID);
    activityInst.setActivityInstId(actInstId);
   
    event.getActInstRep().inertActivityInst(activityInst);
View Full Code Here

    long processInstId = event.getProcessInstance().getProcessInstId();
    ActivityInst activityInst = this.findWaitingActInst(event, processInstId, activityDefId);
    if(activityInst != null)
      return activityInst;
   
    ProcessInstance procInst = event.getProcessInstance();

    activityInst = new ActivityInst();
    activityInst.setActivityDefId(activityDefId);
    activityInst.setActivityType(Constants.ACT_TYPE_SUBPROCESS);
    activityInst.setActivityInstName(activityXml.getName());
    activityInst.setDescription(activityXml.getDescription());
    activityInst.setCurrentState(StarFlowState.ACT_INST_WAITING);
    activityInst.setCreateTime(new Date());
    activityInst.setProcessInstId(procInst.getProcessInstId());
   
    long actInstId = PrimaryKeyUtil.getPrimaryKey(Keys.ACTIVITYINSTID);
    activityInst.setActivityInstId(actInstId);
   
    event.getActInstRep().inertActivityInst(activityInst);
View Full Code Here

    long processInstId = event.getProcessInstance().getProcessInstId();
    ActivityInst activityInst = this.findWaitingActInst(event, processInstId, activityDefId);
    if(activityInst != null)
      return activityInst;
   
    ProcessInstance procInst = event.getProcessInstance();
   
    activityInst = new ActivityInst();
    activityInst.setActivityDefId(activityDefId);
    activityInst.setActivityType(Constants.ACT_TYPE_TOOLAPP);
    activityInst.setActivityInstName(activityXml.getName());
    activityInst.setDescription(activityXml.getDescription());
    activityInst.setCurrentState(StarFlowState.ACT_INST_WAITING);
    activityInst.setCreateTime(new Date());
    activityInst.setProcessInstId(procInst.getProcessInstId());
   
    long actInstId = PrimaryKeyUtil.getPrimaryKey(Keys.ACTIVITYINSTID);
    activityInst.setActivityInstId(actInstId);
   
    event.getActInstRep().inertActivityInst(activityInst);
View Full Code Here

    ActivityInst activityInst = this.findWaitingActInst(event, processInstId, activityDefId);
    if(activityInst != null)
      return activityInst;
   
    List<WorkItem> workItems = null;
    ProcessInstance procInst = ((ActivityCreateEvent)event).getProcessInstance();
   
    List<EventElement> events = activityXml.getEvents();
    //执行环节开始时间
    executeBefore(event.getApplicationContext(), events, procInst.getParentProcInstId());
   
    //获取工作项模式
    String mode = activityXml.getWiMode();
    WorkItemMode wiMode = WorkItemModeFactory.buildWorkItemMode(mode);
    workItems = wiMode.createWorkItem(event, activityXml);
   
    activityInst = new ActivityInst();
    activityInst.setActivityDefId(activityDefId);
    activityInst.setActivityType(Constants.ACT_TYPE_MANUL);
    activityInst.setActivityInstName(activityXml.getName());
    activityInst.setDescription(activityXml.getDescription());
    //TODO 添加多种设置环节时限的方式。
    activityInst.setLimitTime(activityXml.getLimitTime());
    activityInst.setCurrentState(StarFlowState.ACT_INST_WAITING);
    activityInst.setCreateTime(new Date());
    activityInst.setProcessInstId(procInst.getProcessInstId());
   
    long actInstId = PrimaryKeyUtil.getPrimaryKey(Keys.ACTIVITYINSTID);
    activityInst.setActivityInstId(actInstId);
    for(WorkItem w : workItems) {
      w.setActivityInstId(actInstId);
View Full Code Here

* @version 1.0
*/
public class EndActivityType implements ActivityType {

  public ActivityInst createActivity(AbstractFlowEvent event, ActivityElement activityXml) {
    ProcessInstance procInst = event.getProcessInstance();
   
    ActivityInst activityInst = new ActivityInst();
    activityInst.setActivityDefId(activityXml.getId());
    activityInst.setActivityType(activityXml.getType());
    activityInst.setCurrentState(StarFlowState.ACT_INST_WAITING);
    activityInst.setCreateTime(new Date());
    activityInst.setActivityInstName(activityXml.getName());
    activityInst.setProcessInstId(procInst.getProcessInstId());
   
    long actInstId = PrimaryKeyUtil.getPrimaryKey(Keys.ACTIVITYINSTID);
    activityInst.setActivityInstId(actInstId);
   
    event.getActInstRep().inertActivityInst(activityInst);
View Full Code Here

   
    //流程启动前触发事件
    TriggerProcessEventUtil.beforeStart(processEngine, processDefine, null,
        processDefine.getProcessObject().getEvents());
   
    ProcessInstance processInstance = transactionTemplate.execute(new TransactionCallback<ProcessInstance>() {
      public ProcessInstance doInTransaction(TransactionStatus status) {
        ProcessInstance _processInstance = new ProcessInstance();
        _processInstance.setProcessDefId(processDefine.getProcessDefId());
        _processInstance.setProcessInstName(processDefine.getProcessDefName());
        _processInstance.setCreator(userId);
        _processInstance.setCurrentState(StarFlowState.PROCESS_INST_START);
        _processInstance.setSubFlow(subFlow);
        _processInstance.setCreateTime(new Date());
       
        _processInstance.setLimitNum(processDefine.getLimitTime());
        long _id = PrimaryKeyUtil.getPrimaryKey(Keys.PROCESSINSTID);
        _processInstance.setProcessInstId(_id);
        if(parentProcInstId == -1)
          _processInstance.setParentProcInstId(_id);
        else
          _processInstance.setParentProcInstId(parentProcInstId);
       
        if(activityInstId != -1)
          _processInstance.setActivityInstId(activityInstId);
        procInstRep.insertProcessInstance(_processInstance);
        return _processInstance;
      }
    });
    for(ProcessFilter filter : this.processEngine.getProcessFilters()) {
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public void startProcess(long processInstId) {
    final ProcessInstance processInstance = procInstRep.findProcessInstance(processInstId);
   
    //检查流程是否处于启动状态
    if(StarFlowState.PROCESS_INST_START != processInstance.getCurrentState())
      throw new ProcessEngineException("流程实例【"+processInstId+"】未处于启动状态,不能启动流程,当前状态为:" + processInstance.getCurrentState());

    transactionTemplate.execute(new TransactionCallbackWithoutResult() {
     
      @Override
      protected void doInTransactionWithoutResult(TransactionStatus status) {
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public ProcessInstance createAndStartProcess(String processDefName, String userId) {
    final ProcessInstance processInstance = this.createProcess(processDefName, userId);
   
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {
      @Override
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        startProcess(processInstance.getProcessInstId());
        processInstance.setCurrentState(StarFlowState.PROCESS_INST_RUNNING);
      }
    });
   
    return processInstance;
  }
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public void terminateProcess(long processInstId) {
    final ProcessInstance processInstance = procInstRep.findProcessInstance(processInstId);
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {
      @Override
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        EventUtil.publishProcessTerminalEvent(processEngine, processInstance);
      }
View Full Code Here

TOP

Related Classes of com.starflow.wf.engine.model.ProcessInstance

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.