Ejemplo 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;
  }
Ejemplo n.º 2
0
  public boolean load() {
    try {
      if (new File(FILE_PATH).exists()) {
        FileInputStream FIS = new FileInputStream(FILE_PATH);
        JXMLBaseObject cobjXmlObj = new JXMLBaseObject();
        cobjXmlObj.InitXMLStream(FIS);
        FIS.close();

        Vector exps = new Vector();
        Element rootElmt = cobjXmlObj.GetElementByName(JCStoreTableModel.ROOT_NAME);
        for (Iterator i = rootElmt.getChildren().iterator(); i.hasNext(); ) {
          Element crtElmt = (Element) i.next();
          JCExpression exp = new JCExpression();
          exp.mId = crtElmt.getAttributeValue("id", "");
          exp.mName = crtElmt.getAttributeValue("name", "");
          exp.mShowValue = crtElmt.getAttributeValue("show", "");
          exp.mStoreValue = crtElmt.getAttributeValue("store", "");
          exps.add(exp);
        }
        if (mModel != null) {
          mModel.setExpression(exps);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
    return true;
  }