From: <zep...@us...> - 2006-10-17 14:21:37
|
Revision: 65 http://svn.sourceforge.net/pzfilereader/?rev=65&view=rev Author: zepernick Date: 2006-10-17 07:21:32 -0700 (Tue, 17 Oct 2006) Log Message: ----------- removed exception for DataSets containing <record> mappings when an orderBy was called Added logic to push all non-detail records to the bottom of the DataSet on a sort Modified Paths: -------------- trunk/PZFileReader/src/main/java/com/pz/reader/DataSet.java trunk/PZFileReader/src/main/java/com/pz/reader/ordering/OrderBy.java Modified: trunk/PZFileReader/src/main/java/com/pz/reader/DataSet.java =================================================================== --- trunk/PZFileReader/src/main/java/com/pz/reader/DataSet.java 2006-10-16 23:27:19 UTC (rev 64) +++ trunk/PZFileReader/src/main/java/com/pz/reader/DataSet.java 2006-10-17 14:21:32 UTC (rev 65) @@ -1154,9 +1154,11 @@ * @see com.pz.reader.ordering.OrderColumn */ public void orderRows(final OrderBy ob) throws Exception { - if (columnMD.size() > 1) { - throw new Exception("orderRows does not currently support ordering with <RECORD> mappings"); - } + //PZ try to handle other <records> by sending them to + //the bottom of the sort + // if (columnMD.size() > 1) { + // throw new Exception("orderRows does not currently support ordering with <RECORD> mappings"); + // } final List cmds = ParserUtils.getColumnMetaData("detail", columnMD); if (ob != null && rows != null) { ob.setColumnMD(cmds); Modified: trunk/PZFileReader/src/main/java/com/pz/reader/ordering/OrderBy.java =================================================================== --- trunk/PZFileReader/src/main/java/com/pz/reader/ordering/OrderBy.java 2006-10-16 23:27:19 UTC (rev 64) +++ trunk/PZFileReader/src/main/java/com/pz/reader/ordering/OrderBy.java 2006-10-17 14:21:32 UTC (rev 65) @@ -66,9 +66,17 @@ for (int i = 0; i < orderbys.size(); i++) { oc = (OrderColumn) orderbys.get(i); + + //null indicates "detail" record which is what the parser assigns to <column> 's setup outside of <record> elements + //shift all non detail records to the bottom of the DataSet + if (row0.getMdkey() != null && !row0.getMdkey().equals("detail")){ + return 1; + }else if (row1.getMdkey() != null && !row1.getMdkey().equals("detail")){ + return 0; + } + // convert to one type of case so the comparator does not take case // into account when sorting - comp0 = row0.getValue(ParserUtils.findColumn(oc.getColumnName(), columnMD)).toLowerCase(); comp1 = row1.getValue(ParserUtils.findColumn(oc.getColumnName(), columnMD)).toLowerCase(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |