[Idrs-commit] CVS: Idrs/dev/src/net/sourceforge/idrs/core/report FieldsLine.java,NONE,1.1 CurrentFie
Brought to you by:
bigman921
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11199/src/net/sourceforge/idrs/core/report Modified Files: AttributeLine.java IDRSCompiler.java IDRSHead.java TagLine.java Added Files: FieldsLine.java CurrentField.java Log Message: * Removed "proprietary" xml binding * Added support for JAXB * Added "fields" tag, so that if the fields are not known ahead of time, they may be iterated over * updated some copyrights --- NEW FILE: FieldsLine.java --- /* FieldsLine.java Copyright (C) 2002 Marc Boorshtein The contents of this file are subject to the Mozilla Public License Version 1.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. */ package net.sourceforge.idrs.core.report; import java.io.Serializable; import java.util.ArrayList; import java.util.*; import org.w3c.dom.Document; import org.w3c.dom.Element; import net.sourceforge.idrs.utils.*; /** * @author mlb * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class FieldsLine extends Line implements Chunk, Serializable { String tagName; private Vector vlines; private Line[] lines; private DB db; private String dbname; public FieldsLine(String dbname) { this.dbname = dbname; vlines = new Vector(); } /** * Sets the vector constaing the lines for the containor @param line Line to add */ public void addLine(Line line) { vlines.add(line); } /** * Sets the vector constaing the lines for the containor *@param lines Lines being used */ public void setLines(Vector lines) { this.vlines = lines; } /* (non-Javadoc) * @see net.sourceforge.idrs.core.report.Chunk#toString(net.sourceforge.idrs.core.report.IDRSHead) */ public String toString(IDRSHead head) throws Exception { // TODO Auto-generated method stub return ""; } /** * "Seals" the report head into static data structures from dynamic ones */ public void seal() { if (! sealed) { ArrayList llines = new ArrayList(); int i=0; for (i=0;i<vlines.size();i++) { Line l = (Line) (Line) vlines.get(i); if (l != null) { //((Line) lines[i]).seal(); } else { lines[i] = new Line(); ((Line) lines[i]).addChunk(new TextChunk("")); ((Line) lines[i]).seal(); } llines.add(l); } lines = new Line[llines.size()]; System.arraycopy(llines.toArray(),0,lines,0,lines.length); sealed = true; vlines.removeAllElements(); } } /** Public method to retrieve the information about the all of the Chunks stored in the Line @param head IDRSHead of report @param buffer Buffered output of report */ public String toString(IDRSHead head, StringBuffer buffer) throws Exception { StringBuffer tmp = new StringBuffer(500); Line line; int i; String ln; i = 0; db = head.getDB(dbname); Set fieldNames = db.getFieldNames(); Iterator it = fieldNames.iterator(); while (it.hasNext()) { String fieldName = (String) it.next(); db.setCurrentFiledName(fieldName); i=0; while (i < this.lines.length) { line = lines[i]; ln = line.toString(head,tmp); //if (ln != null) if (tmp.charAt(tmp.length()-1)!='\n') tmp.append("\n"); i++; } } i=0; tmp.deleteCharAt(tmp.length()-1); buffer.append(tmp.toString()); //return output.toString(); return null; } public void toDOM(IDRSHead head, Document doc, Element root) throws Exception { StringBuffer tmp = new StringBuffer(500); int i =0,m; Line line; String ln; //StringBuffer output = new StringBuffer(""); DB db = head.getDB(this.dbname); Set fieldNames = db.getFieldNames(); Iterator it = fieldNames.iterator(); while (it.hasNext()) { String fieldName = (String) it.next(); db.setCurrentFiledName(fieldName); i = 0; while (i < this.lines.length) { line = lines[i]; line.toDOM(head,doc,root); i++; } } i=0; } } --- NEW FILE: CurrentField.java --- /* CurrentField.java Copyright (C) 2002 Marc Boorshtein The contents of this file are subject to the Mozilla Public License Version 1.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. */ /* * Created on Aug 28, 2004 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package net.sourceforge.idrs.core.report; import java.io.Serializable; /** * @author mlb * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class CurrentField implements Chunk, Serializable { String dbName; public CurrentField(String dbname) { this.dbName = dbname; } /* (non-Javadoc) * @see net.sourceforge.idrs.core.report.Chunk#toString(net.sourceforge.idrs.core.report.IDRSHead) */ public String toString(IDRSHead head) throws Exception { return head.getDB(dbName).getCurrentFieldName(); } } Index: AttributeLine.java =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/AttributeLine.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AttributeLine.java 22 Aug 2004 23:52:31 -0000 1.1 --- AttributeLine.java 29 Aug 2004 04:50:29 -0000 1.2 *************** *** 1,8 **** /* ! * Created on Aug 22, 2004 ! * ! * TODO To change the template for this generated file go to ! * Window - Preferences - Java - Code Style - Code Templates ! */ package net.sourceforge.idrs.core.report; --- 1,14 ---- /* ! AttributeLine.java ! Copyright (C) 2002 Marc Boorshtein ! ! The contents of this file are subject to the Mozilla Public License Version 1.0 (the License); ! you may not use this file except in compliance with the License. You may obtain a copy of the ! License at http://www.mozilla.org/MPL/ ! ! Software distributed under the License is distributed on an "AS IS" basis, ! WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific ! language governing rights and limitations under the License. ! */ package net.sourceforge.idrs.core.report; Index: IDRSCompiler.java =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/IDRSCompiler.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** IDRSCompiler.java 22 Aug 2004 23:52:31 -0000 1.6 --- IDRSCompiler.java 29 Aug 2004 04:50:29 -0000 1.7 *************** *** 1128,1131 **** --- 1128,1132 ---- start = line.length(); } + else if (line.indexOf("<tag") != -1) { start = line.indexOf("\"",line.indexOf("name")) + 1; Index: IDRSHead.java =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/IDRSHead.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** IDRSHead.java 22 Aug 2004 05:17:40 -0000 1.18 --- IDRSHead.java 29 Aug 2004 04:50:29 -0000 1.19 *************** *** 60,63 **** --- 60,64 ---- protected transient ObjectStore currStore; + private ArrayList xmlObjects; *************** *** 159,165 **** */ public void init(HashMap conns, int userNum, int docID, String url, HttpSession session, ! HttpServletRequest request,HttpServletResponse response, Application app, IDRSScriptLanguage context,UserInfo userInfo,String digest,ServletContext servcontext,Element dom,String basePackage) throws Exception { this.context = servcontext; ! this.digest = digest; --- 160,166 ---- */ public void init(HashMap conns, int userNum, int docID, String url, HttpSession session, ! HttpServletRequest request,HttpServletResponse response, Application app, IDRSScriptLanguage context,UserInfo userInfo,String digest,ServletContext servcontext,ArrayList xmlObjs) throws Exception { this.context = servcontext; ! this.xmlObjects = xmlObjs; this.digest = digest; *************** *** 223,229 **** if (obj.setProps()) obj.setProps(request); ! if (dom != null) { obj.importDOM(dom,basePackage); ! } } --- 224,230 ---- if (obj.setProps()) obj.setProps(request); ! /*if (dom != null) { obj.importDOM(dom,basePackage); ! }*/ } *************** *** 797,800 **** --- 798,805 ---- return ret; } + + public ArrayList getXMLObjects() { + return this.xmlObjects; + } } Index: TagLine.java =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/TagLine.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TagLine.java 22 Aug 2004 23:52:31 -0000 1.1 --- TagLine.java 29 Aug 2004 04:50:29 -0000 1.2 *************** *** 1,8 **** /* ! * Created on Aug 22, 2004 ! * ! * TODO To change the template for this generated file go to ! * Window - Preferences - Java - Code Style - Code Templates ! */ package net.sourceforge.idrs.core.report; --- 1,14 ---- /* ! TagLine.java ! Copyright (C) 2002 Marc Boorshtein ! ! The contents of this file are subject to the Mozilla Public License Version 1.0 (the License); ! you may not use this file except in compliance with the License. You may obtain a copy of the ! License at http://www.mozilla.org/MPL/ ! ! Software distributed under the License is distributed on an "AS IS" basis, ! WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific ! language governing rights and limitations under the License. ! */ package net.sourceforge.idrs.core.report; *************** *** 171,174 **** --- 177,182 ---- //StringBuffer output = new StringBuffer(""); + System.out.println("tagname : " + tagName); + Element element = doc.createElement(tagName); if (root == null) { |