Package com.exedosoft.wf

Examples of com.exedosoft.wf.WFException


      pi.setPtUid(pt.getObjUid());
      String ptName = pt.getPtName();
      BOInstance bi = pt.getDoBO().getCorrInstance();
      if (bi == null) {
        t.rollback();
        throw new WFException("启动工作流失败:没有与业务表关联!");
      }
      pi.setInstanceUid(bi.getUid());
      if (bi.getName() != null && !bi.getName().equals("N/A")) {
        ptName = bi.getName();
      }

      if (pt.getDoBO2() != null) {
        BOInstance bi2 = DOGlobals.getInstance().getSessoinContext()
            .get(pt.getDoBO2());
        if (bi2 != null) {
          pi.setInstanceUid2(bi2.getUid());
        }
      }
      if (pt.getDoBO3() != null) {

        BOInstance bi3 = DOGlobals.getInstance().getSessoinContext()
            .get(pt.getDoBO3());
        if (bi3 != null) {
          pi.setInstanceUid3(bi3.getUid());
        }
      }

      pi.setWfiName(ptName);
      pi.setStartTime(new java.sql.Timestamp(System.currentTimeMillis()));

      SessionContext us = DOGlobals.getInstance().getSessoinContext();

      if(us.getUser()!=null){
        pi.setStartUser(us.getUser().getUid());
      }

      if (isRun) {
        pi.setExeStatus(Integer.valueOf(ProcessInstance.STATUS_RUN));
      }

      DAOUtil.BUSI().store(pi); // /////保存工作流实例

      PTNode startNode = pt.getStartNode();
      niStart = NodeInstance.initNodeInstance(pi, startNode,
          NodeInstance.STATUS_FREE);
      DAOUtil.BUSI().store(niStart);

      // // /////////如果模板存在节点
      // if (pt.getNodes() != null && pt.getNodes().size() > 0) {
      //
      // // ///存储Node 和 NodeInstance 的对应关系
      // // /////原因是要找到开始Node才能建立关联,要两次遍历
      // // //否则没必要用Map 保持他们的联系
      // PTNode start = null; // ////定义开始节点
      // HashMap mapNode = new HashMap();
      // // ///////////// 保存节点实例及下面的Actions,并返回开始节点
      // start = copyToNodeInstances(dao, pi, mapNode);
      // // ////////////建立该模板下的节点实例之间的关系。
      // buildInstanceRelation(pt, mapNode, dao);
      //             
      // niStart = (NodeInstance) mapNode.get(start);
      // } else {
      // throw new WFException("启动工作流失败:没有为工作流模板定义节点");
      // }
      // /////end copy nodes

      // /////////copy vars
      if (pt.retrievePtVars() != null && pt.retrievePtVars().size() > 0) {
        copyToVarInstances(pi);
      }
      // ///////////end copy vars

      // ////////////把控制权交给 Start NodeInstance.
      niStart.setExeStatus(Integer.valueOf(NodeInstance.STATUS_INIT));

      // niStart.perform();
    } catch (Exception ex) {
      t.rollback();
      throw new WFException("启动工作流失败", ex);
    } finally {
      t.end();
    }

    System.out.println("Start::" + niStart);
View Full Code Here


            ni.setExeStatus(Integer.valueOf(NodeInstance.STATUS_FREE)); // //设置为空闲状态
            DAOUtil.BUSI().store(ni);
            return ni;
          }
        } else {
          throw new WFException("无法恢复conjunction类型的节点:" + ni);
        }
      }
    } catch (Exception ex) {
      throw new WFException("无法获得节点实例", ex);
    }
    // finally {
    // dao.closeSession();
    // }
    ni.setExeStatus(Integer.valueOf(NodeInstance.STATUS_INIT)); // //设置为初始化状态
View Full Code Here

    try {
      ni = DAOUtil.BUSI().getByObjUid(NodeInstance.class, niUID);
      if (ni.getNodeType() != null
          && (ni.getNodeType().intValue() == PTNode.TYPE_AND_CONJUNCTION || ni
              .getNodeType().intValue() == PTNode.TYPE_OR_CONJUNCTION)) {
        throw new WFException("Conjunction类型的节点无法挂起");
      }
      ni.setExeStatus(Integer.valueOf(NodeInstance.STATUS_HANGUP));
      DAOUtil.BUSI().store(ni);
      return ni;
    } catch (Exception ex) {
      throw new WFException("节点挂起时出错" + ni, ex);
    }
    // finally {
    // dao.closeSession();
    // }
View Full Code Here

    List postNodes = this.getPostNodes();
    NodeInstance postNode = (NodeInstance) postNodes.get(0);
    if (postNode.getProcessInstance().getExeStatus() != null
        && (postNode.getProcessInstance().getExeStatus().intValue() != ProcessInstance.STATUS_RUN)) {
      throw new WFException("流程已不在运行中,无法撤回!");
    }
    if (postNode.getNodeType() != null
        && postNode.getNodeType().intValue() != PTNode.TYPE_ACTIVITY) {
      postNodes = postNode.getPostNodes();
    }
    for (Iterator it = postNodes.iterator(); it.hasNext();) {
      NodeInstance aNi = (NodeInstance) it.next();
      if (aNi.getExeStatus() != null
          && aNi.getExeStatus().intValue() == NodeInstance.STATUS_FINISH) {
        throw new WFException("后续流程已经执行,无法撤回!");
      }
    }

    // WFDAO dao = new WFDAO();
    // dao.setAutoClose(false);
    try {
      for (Iterator it = postNodes.iterator(); it.hasNext();) {
        NodeInstance aPost = (NodeInstance) it.next();
        aPost.setExeStatus(Integer.valueOf(NodeInstance.STATUS_INIT));
        DAOUtil.BUSI().store(aPost);
      }
      this.setExeStatus(Integer.valueOf(NodeInstance.STATUS_RUN));
      this.setBackType(Integer.valueOf(NodeInstance.BACK_WITHDRAW));

      DAOUtil.BUSI().store(this);
    } catch (Exception e) {
      throw new WFException("处理回退时出错:" + this, e);
    }
    // finally {
    // dao.closeSession();
    // }
View Full Code Here

    PTNode preNode = (PTNode) prePTNodes.get(0);
    NodeInstance theNewBackNI = null;
    if (preNode.getNodeType() != null
        && preNode.getNodeType().intValue() == PTNode.TYPE_START) {
      throw new WFException("前面已经没有节点,无法回退!");
    }
    // PTNode.TYPE_SELF////////////这种情况单独考虑.

    if (preNode.getNodeType() != null
        && preNode.getNodeType().intValue() != PTNode.TYPE_ACTIVITY) {
      prePTNodes = preNode.getPreNodes();
    }

    String backStr = null;
    // WFDAO dao = new WFDAO();
    // dao.setAutoClose(false);
    try {

      for (Iterator it = prePTNodes.iterator(); it.hasNext();) {
        PTNode aPre = (PTNode) it.next();
        // ///////////处理回退
        theNewBackNI = buildNewRelation(aPre, null, type);
        // ////////////////处理回退
      }
      backStr = this.getNode().getNodeStateShowBack();
      if (backStr == null || "".equals(backStr.trim())) {
        backStr = "回退";
      }
      this.setExeStatus(NodeInstance.STATUS_FINISH);
      storePropertyValues();
      DAOUtil.BUSI().store(this);
    } catch (Exception e) {
      throw new WFException("处理回退时出错:" + this, e);
    }
    return theNewBackNI;

  }
View Full Code Here

          e.printStackTrace();
        }
      }

    } catch (Exception e) {
      throw new WFException("自由转向时出错:" + this, e);
    }
    return newInstance;

  }
View Full Code Here

      this.setExeStatus(Integer.valueOf(NodeInstance.STATUS_FINISH));
      DAOUtil.BUSI().store(this);

    } catch (Exception e) {
      e.printStackTrace();
      throw new WFException("回退到发起人时出错:" + this, e);
    }
    // finally {
    // dao.closeSession();
    // }
View Full Code Here

      }

      DAOUtil.BUSI().store(this);

    } catch (Exception ex) {
      throw new WFException("人工执行节点时出错:" + this, ex);
    }
    // finally {
    // dao.closeSession();
    // }
View Full Code Here

    dealProcessState(this.nodeStateShow);

    try {
      DAOUtil.BUSI().store(this);
    } catch (Exception ex) {
      throw new WFException("节点开始执行,持久化状态时出错:" + this, ex);
    }

    /**
     * 人工节点人工执行
     */
 
View Full Code Here

    // dao.setAutoClose(false);
    try {
      DAOUtil.BUSI().store(this);
      log.info("节点执行完成:::::::::::::::" + this);
    } catch (Exception ex) {
      throw new WFException("节点执行完成,持久化状态时出错:" + this, ex);
    }
    // finally {
    // dao.closeSession();
    // }
    exeNextNodes();
View Full Code Here

TOP

Related Classes of com.exedosoft.wf.WFException

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.