Exemplo n.º 1
0
  /** 打开查询结果 */
  public static String[] openQuery(Hashtable params) {

    JParamObject PO = new JParamObject();

    for (Enumeration e = params.keys(); e.hasMoreElements(); ) {
      String key = (String) e.nextElement();
      String val = (String) params.get(key);
      PO.SetValueByParamName(key, val);
    }
    String[] queryResult = new String[2];
    JResponseObject RO =
        (JResponseObject)
            JActiveDComDM.AbstractDataActiveFramework.InvokeObjectMethod(
                "DataReport", "OpenQuery", PO, "");
    String XMLStr = (String) RO.ResponseObject;
    if (RO != null && RO.ResponseObject != null) {
      XMLStr = (String) RO.ResponseObject;
      JXMLBaseObject XMLObj = new JXMLBaseObject(XMLStr);
      Element queryElmt = XMLObj.GetElementByName("Query");
      // 格式
      queryResult[0] = queryElmt.getAttributeValue("QueryFormat");
      // 数据
      queryResult[0] = queryElmt.getAttributeValue("QueryData");
    }
    return queryResult;
  }
Exemplo n.º 2
0
  /**
   * 判断相等
   *
   * @param params0
   * @param params1
   * @return
   */
  public static boolean equals(Hashtable params0, Hashtable params1) {
    // 相等,包括均为空
    if (params0 == null && params1 == null) {
      return true;
    }
    // 非空
    if (params0 == null || params1 == null) {
      return false;
    }

    if (params0.size() != params1.size()) {
      return false;
    }
    // 键和值相等
    for (Enumeration e = params0.keys(); e.hasMoreElements(); ) {
      String key0 = (String) e.nextElement();
      String val0 = (String) params0.get(key0);

      if (params1.containsKey(key0)) {
        String val1 = (String) params1.get(key0);
        if (!val0.equals(val1)) {
          return false;
        }
      } else {
        return false;
      }
    }
    return true;
  }
Exemplo n.º 3
0
  /**
   * 合并参数列表
   *
   * @param p0
   * @param p1
   * @return
   */
  public static Hashtable join(Hashtable p0, Hashtable p1) {
    if (p0 != null && p1 != null) {

      Hashtable p = new Hashtable();
      for (Enumeration e = p0.keys(); e.hasMoreElements(); ) {
        String key = (String) e.nextElement();
        String value = (String) p0.get(key);
        p.put(key, value);
      }

      for (Enumeration e = p1.keys(); e.hasMoreElements(); ) {
        String key = (String) e.nextElement();
        if (!p0.containsKey(key)) {
          p.put(key, p1.get(key));
        }
      }

      return p;
    }
    return p0;
  }