# HG changeset patch # User Felix Wolfsteller # Date 1330943391 0 # Node ID e3fd2d2fab6d4fffe6a370fc98b78f255336ef74 # Parent 4514b0158b10c91ff571c04aa2ab167fe32881cc Partial fix flys/issue 528 (csv of reference curves. pdf missing). flys-artifacts/trunk@4116 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 4514b0158b10 -r e3fd2d2fab6d flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Mar 05 10:16:26 2012 +0000 +++ b/flys-artifacts/ChangeLog Mon Mar 05 10:29:51 2012 +0000 @@ -1,3 +1,10 @@ +2012-03-05 Felix Wolfsteller + + Fix flys/issue 528 for csv. + + * src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java: + Fixed column order, reworked todos. + 2012-03-05 Felix Wolfsteller * src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java: diff -r 4514b0158b10 -r e3fd2d2fab6d flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java Mon Mar 05 10:16:26 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java Mon Mar 05 10:29:51 2012 +0000 @@ -175,40 +175,34 @@ protected void writeCSVHeader(CSVWriter writer) { logger.info("ReferenceCurveExporter.writeCSVHeader"); - StepCSVWriter stepWriter; + StepCSVWriter stepWriter = new StepCSVWriter(); + stepWriter.setCSVWriter(writer); - // TODO use StepCVSWriter here - ArrayList list = new ArrayList(); - list.addAll(Arrays.asList( new String[] { - msg(RC_CSV_KM_HEADER, RC_DEFAULT_CSV_KM_HEADER), - msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER), - msg(RC_CSV_W_M_HEADER, RC_DEFAULT_CSV_W_M_HEADER) - })); - if (startAtGauge) { - list.addAll(Arrays.asList( new String[] { - msg(RC_CSV_W_CM_HEADER, RC_DEFAULT_CSV_W_CM_HEADER) - })); - } - list.addAll(Arrays.asList( new String[] { - msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER), + stepWriter.addNexts( msg(RC_CSV_KM_HEADER, RC_DEFAULT_CSV_KM_HEADER), + msg(RC_CSV_W_M_HEADER, RC_DEFAULT_CSV_W_M_HEADER) + ); + if (startAtGauge) { + stepWriter.addNext( + msg(RC_CSV_W_CM_HEADER, RC_DEFAULT_CSV_W_CM_HEADER)); + } + stepWriter.addNexts( + msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER), msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER), + msg(RC_CSV_KM_HEADER, RC_DEFAULT_CSV_KM_HEADER), msg(RC_CSV_W_M_HEADER, RC_DEFAULT_CSV_W_M_HEADER) - })); + ); if (endAtGauge) { - list.addAll(Arrays.asList( new String[] { - msg(RC_CSV_W_CM_HEADER, RC_DEFAULT_CSV_W_CM_HEADER), - msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER) - })); + stepWriter.addNext( + msg(RC_CSV_W_CM_HEADER, RC_DEFAULT_CSV_W_CM_HEADER) + ); } - else { - list.addAll(Arrays.asList( new String[] { - msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER) - })); - } + stepWriter.addNexts( + msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER), + msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER) + ); - - writer.writeNext(list.toArray(new String[list.size()])); + stepWriter.flush(); } @@ -233,16 +227,16 @@ flys, ww.getEndKm()); for (int i = 0; i < size; i ++) { - stepWriter.addNexts(kmf.format(ww.getStartKm()), - startLocationDescription); + stepWriter.addNexts(kmf.format(ww.getStartKm())); stepWriter.addNext(wf.format(ww.getW1(i))); if (startAtGauge) { stepWriter.addNext(wf.format(ww.getRelHeight1Cm(i))); } stepWriter.addNexts( qf.format(ww.getQ1(i)), // "Q" - kmf.format(ww.getEndKm()), - endLocationDescription); + startLocationDescription, + kmf.format(ww.getEndKm()) + ); stepWriter.addNext(wf.format(ww.getW2(i))); if (endAtGauge) { if (ww.endAtGauge()) { @@ -252,7 +246,9 @@ stepWriter.addNext("-"); } } - stepWriter.addNext(qf.format(ww.getQ2(i)) // "Q" + stepWriter.addNexts( + qf.format(ww.getQ2(i)), // "Q" + endLocationDescription ); stepWriter.flush(); }