예제 #1
0
  /**
   * 作者:王印芬 功能:根据传入的分级标志及父PK,得到所有子PK,包括父PK 参数:String sPkBdInfo 为表bd_bdinfo的pk_bdinfo,有如下含义:
   * pk_bdinfo bdcode bdname 00010000000000000002 2 部门档案 00010000000000000012 12 地区分类 String sCurP
   * 当前的PK,如当前的地区分类ID String[] saPk_corp 需查的所有公司 返回:String[] 包括父PK的所有PK 例外:有可能是由于查询下级分类时抛出的异常,应为系统异常
   * 日期:(2003-4-15 11:39:21) 修改日期,修改人,修改原因,注释标志:
   */
  private static ArrayList getTotalSubPkAndNames(
      String sPkBdInfo, String sCurPk, String sCurName, String[] saPk_corp) throws Exception {

    ArrayList resultArray = new ArrayList();
    // 参数正确性检查
    if (sPkBdInfo == null) {
      return null;
    }

    int iPk_corpCount = 1;
    if (saPk_corp != null) {
      iPk_corpCount = saPk_corp.length;
    }
    // IBDAccessor[] ibdaAcc = new IBDAccessor[iPk_corpCount] ;
    Vector vecPk = new Vector(10);
    vecPk.addElement(sCurPk);

    Vector vecName = new Vector(10);
    vecName.addElement(sCurName);

    for (int i = 0; i < iPk_corpCount; i++) {
      IBDAccessor ibdaAcc = null;
      if (saPk_corp == null) {
        ibdaAcc = AccessorManager.getAccessor(sPkBdInfo);
      } else {
        ibdaAcc = AccessorManager.getAccessor(sPkBdInfo, saPk_corp[i]);
      }

      // 将原先的ibdaAcc.getChildDocsByHierarchy(sCurPk)改为ibdaAcc.getChildDocs(sCurPk);
      // 原先getChildDocsByHierarchy方法认为叶子节点是非层次结构,
      // 自动以sCurPk对应的档案的编码为前缀,返回编码包含该前缀的所有档案。应该是返回null或自身均可。by zhangcheng
      // 07-9-18
      BddataVO[] voaBdData = ibdaAcc.getChildDocs(sCurPk);
      if (voaBdData != null) {
        int iRetLen = voaBdData.length;
        for (int j = 0; j < iRetLen; j++) {
          vecPk.addElement(voaBdData[j].getPk());
          vecName.addElement(voaBdData[j].getName());
        }
      }
    }

    int iSize = vecPk.size();
    resultArray.add((String[]) (vecPk.toArray(new String[iSize])));
    resultArray.add((String[]) (vecName.toArray(new String[iSize])));
    return resultArray;
  }
예제 #2
0
  /**
   * 作者:王印芬 功能:根据传入的分级标志及父PK,得到所有子PK,包括父PK 参数:String sPkBdInfo 为表bd_bdinfo的pk_bdinfo,有如下含义:
   * pk_bdinfo bdcode bdname 00010000000000000002 2 部门档案 00010000000000000012 12 地区分类 String sCurP
   * 当前的PK,如当前的地区分类ID String[] saPk_corp 需查的所有公司 返回:String[] 包括父PK的所有PK 例外:有可能是由于查询下级分类时抛出的异常,应为系统异常
   * 日期:(2003-4-15 11:39:21) 修改日期,修改人,修改原因,注释标志:
   */
  public static String[] getTotalSubPks(String sPkBdInfo, String sCurPk, String[] saPk_corp)
      throws Exception {

    // 参数正确性检查
    if (sPkBdInfo == null) {
      return null;
    }

    int iPk_corpCount = 1;
    if (saPk_corp != null) {
      iPk_corpCount = saPk_corp.length;
    }
    // IBDAccessor[] ibdaAcc = new IBDAccessor[iPk_corpCount] ;
    Vector vecPk = new Vector(10);
    vecPk.addElement(sCurPk);

    for (int i = 0; i < iPk_corpCount; i++) {
      IBDAccessor ibdaAcc = null;
      if (saPk_corp == null) {
        ibdaAcc = AccessorManager.getAccessor(sPkBdInfo);
      } else {
        ibdaAcc = AccessorManager.getAccessor(sPkBdInfo, saPk_corp[i]);
      }

      BddataVO[] voaBdData = ibdaAcc.getChildDocs(sCurPk);
      if (voaBdData != null) {
        int iRetLen = voaBdData.length;
        for (int j = 0; j < iRetLen; j++) {
          vecPk.addElement(voaBdData[j].getPk());
        }
      }
    }

    int iSize = vecPk.size();
    return (String[]) (vecPk.toArray(new String[iSize]));
  }