Package com.starflow.wf.engine

Examples of com.starflow.wf.engine.ProcessEngineException


        action.execute(exception, cloneProcessInstance, cloneActivityInst);
      } else {
        //反射调用bean指定的方法。
        String methodName = beanName.substring(index + 1);
        if("".equals(beanName))
          throw new ProcessEngineException("IApplicationExecptionAction 实现类Bean:"+beanName+",没有指定方法名称");
       
        beanName = beanName.substring(0, index);
        try {
          Method method = action.getClass().getMethod(methodName, long.class, long.class);
          method.invoke(action, exception, cloneProcessInstance, cloneActivityInst);
        } catch (Exception e) {
          throw new ProcessEngineException("IApplicationExecptionAction 实现类Bean:"+beanName+",没有此方法", e);
        }
      }
    } catch (Exception e) {
      throw new ProcessEngineException("自动环节异常处理逻辑执行失败", e);
    }
  }
View Full Code Here


   */
  private static void handleException(Exception e, EventElement eventXml) {
    String exceptionStrategy = eventXml.getExceptionStrategy();
   
    if(Constants.ACT_EXCEPTIONSTRATEGY_ROLLBACK.equals(exceptionStrategy))
      throw new ProcessEngineException("触发事件执行失败", e);
    else {
      logger.error("触发事件执行失败", e);
    }
  }
View Full Code Here

    try {
      action.execute(processDefine, processInstance);
      txManager.commit(status);
    } catch (Exception e) {
      txManager.rollback(status);
      throw new ProcessEngineException("触发事件执行失败", e);
    }
  }
View Full Code Here

          e.printStackTrace();
        }
      }
      deployProcessXML(sb.toString());
    } catch (FileNotFoundException e1) {
      throw new ProcessEngineException("流程文件没有查找到", e1);
    } catch (UnsupportedEncodingException e1) {
      e1.printStackTrace();
    }
  }
View Full Code Here

   */
  public void finishActivity(long activityInstId) {
    final ActivityInst activityInst = this.actInstRep.findActivityInst(activityInstId);
    //判断环节是否处于运行状态,才可完成该工作项
    if(StarFlowState.ACT_INST_RUNING != activityInst.getCurrentState())
      throw new ProcessEngineException("当前环节(activityInstId="+activityInst.getActivityInstId()+")不处于状态,"+
          "无法完成环节的运行!");
   
    final ProcessInstance processInstance = this.procInstRep.findProcessInstance(activityInst.getProcessInstId());
    final ProcessDefine processDefine = this.procDefRep.findProcessDefine(processInstance.getProcessDefId());
    final ActivityElement activityXml = processDefine.getProcessObject().getActivitys().get(activityInst.getActivityDefId());
View Full Code Here

  }
 
  public void startActivityInst(long processInstId, String activityDefId) {
    final ProcessInstance processInstance = procInstRep.findProcessInstance(processInstId);
    if(StarFlowState.PROCESS_INST_RUNNING != processInstance.getCurrentState())
      throw new ProcessEngineException("流程不处于运行状态,不能重启环节!");
   
    final ProcessDefine processDefine = this.procDefRep.findProcessDefine(processInstance.getProcessDefId());
    final ActivityElement activityXml = processDefine.getProcessObject().getActivitys().get(activityDefId);
   
    if(activityXml == null)
      throw new ProcessEngineException("指定启动环节【{}】不存在" + activityDefId);
   
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {
      @Override
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        String actType = activityXml.getType();
View Full Code Here

   * @see com.starit.wf.engine.domain.service.IActivityInstService#restartActivity(long)
   */
  public void restartActivity(long processInstId, long activityInstId) {
    ProcessInstance processInstance = procInstRep.findProcessInstance(processInstId);
    if(StarFlowState.PROCESS_INST_RUNNING != processInstance.getCurrentState())
      throw new ProcessEngineException("流程不处于运行状态,不能重启环节!");
   
    ActivityInst activityInst = actInstRep.findActivityInst(activityInstId);
    if(activityInst == null || activityInst.getCurrentState() == StarFlowState.ACT_INST_RUNING
        || activityInst.getCurrentState() == StarFlowState.ACT_INST_WAITING
        || activityInst.getCurrentState() == StarFlowState.ACT_APP_EXCEPTION) {
      throw new ProcessEngineException("环节只有处在完成、终止、应用异常状态,才可以重启环节");
    }
   
//    if(!Constants.ACT_TYPE_MANUL.equals(activityInst.getActivityType())) {
//      throw new ProcessEngineException("只有人工环节才可以重启环节,当前环节类型为:"+activityInst.getActivityType());
//    }
View Full Code Here

      @Override
      protected void doInTransactionWithoutResult(TransactionStatus status) {
       
        //判断环节是否处于运行状态,才可完成该工作项
        if(StarFlowState.ACT_INST_WAITING != activityInst.getCurrentState())
          throw new ProcessEngineException("当前环节(activityInstId="+activityInst.getActivityInstId()+")不处于待激活状态,"+
              "无法激活该环节!");
       
        //创建环节
        ActivityCreateEvent event = new ActivityCreateEvent(processEngine);
        event.setProcessInstance(processInstance);
View Full Code Here

   */
  public void rollbackToActivityFroRecentManual(final long currentActInstID) {
    final ActivityInst activityInst = this.actInstRep.findActivityInst(currentActInstID);
    //判断环节是否处于运行状态,才可执行回退
    if(StarFlowState.ACT_INST_RUNING != activityInst.getCurrentState())
      throw new ProcessEngineException("当前环节(activityInstId="+activityInst.getActivityInstId()+")不处于运行状态,"+
          "不能执行回退。");
   
    final ProcessInstance processInstance = this.procInstRep.findProcessInstance(activityInst.getProcessInstId());
    List<TransCtrl> trans = this.actInstRep.findTransCtrls(activityInst.getProcessInstId());
   
    String recentActDefId = null;
    String destActId = activityInst.getActivityDefId();
    for(TransCtrl transCtrl : trans) {
      if(transCtrl.getDestActDefId().equalsIgnoreCase(destActId) //如果不是人工环节,继续向前循环
          && !Constants.ACT_TYPE_MANUL.equalsIgnoreCase(transCtrl.getSrcActType())) {
        destActId = transCtrl.getSrcActDefId();
      } else if(transCtrl.getDestActDefId().equalsIgnoreCase(destActId)
          && Constants.ACT_TYPE_MANUL.equalsIgnoreCase(transCtrl.getSrcActType())) {
        recentActDefId = transCtrl.getSrcActDefId();
        break;
      }
    }
    if(recentActDefId == null)
      throw new ProcessEngineException("最近一个人工环节没有找到,无法回退");
   
    rollBackExecute(currentActInstID, activityInst, processInstance,
        recentActDefId);
  }
View Full Code Here

    final WorkItem workItem = this.workItemRep.findWorkItem(workItemId);
    final ActivityInst activityInst = this.actInstRep.findActivityInst(workItem.getActivityInstId());
   
    //判断环节是否处于运行状态,才可完成该工作项
    if(StarFlowState.ACT_INST_RUNING != activityInst.getCurrentState())
      throw new ProcessEngineException("当前环节(activityInstId="+activityInst.getActivityInstId()+")不处于状态,"+
          "无法完成环节的运行!");
   
    //判断工作项是否处于待接收或运行状态,才可完成该工作项
    if(workItem.getCurrentState() != StarFlowState.WORKITEM_WAITING_RECEIVE &&
        workItem.getCurrentState() != StarFlowState.WORKITEM_RUNNING)
      throw new ProcessEngineException("当前工作项(workitemid="+workItemId+")不处于状态,"+
          "无法完成工作项的运行!");
   
    final ProcessInstance processInstance = this.procInstRep.findProcessInstance(workItem.getProcessInstId());
    final ProcessDefine processDefine = this.procDefRep.findProcessDefine(processInstance.getProcessDefId());
    final ActivityElement activityXml = processDefine.getProcessObject().getActivitys().get(activityInst.getActivityDefId());
View Full Code Here

TOP

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

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.