/** 打开查询结果 */ 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; }
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; }
public void save() { try { if (mModel != null) { JXMLBaseObject cobjXmlObj = mModel.toXml(); String dataStr = cobjXmlObj.GetRootXMLString(); FileOutputStream FOS = new FileOutputStream(FILE_PATH); FOS.write(dataStr.getBytes()); FOS.flush(); FOS.close(); } } catch (Exception e) { e.printStackTrace(); } }
public void InitFunctionConfigXML(String Name) { String URI = null; if (Name == null) System.out.print("Name=null"); if (FunctionConfigXML != null) return; // RB = this.getClass().getName().replace('.','/');; // RB = "Codebase/"+RB; java.net.URL url = JXMLResource.LoadXML(this, Name, ""); if (url == null) { System.out.println("url=null"); return; } URI = url.toString(); // URI = JActiveDComDM.CodeBase+RB+"/function.xml"; FunctionConfigXML = new JXMLBaseObject(); FunctionConfigXML.InitXMLURI(URI); }