# HG changeset patch # User Sascha L. Teichmann # Date 1372443614 -7200 # Node ID 1e6bd283128069862e434ece4b22fa024d7ae83e # Parent b2eab164a4415cc119fa64e62a5705a7754aef8f artifacts: Desktop-FLYS conform official line messages in error reports. diff -r b2eab164a441 -r 1e6bd2831280 artifacts/src/main/java/org/dive4elements/river/artifacts/model/OfficialLineFinder.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/OfficialLineFinder.java Fri Jun 28 19:24:46 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/OfficialLineFinder.java Fri Jun 28 20:20:14 2013 +0200 @@ -10,6 +10,7 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,6 +26,7 @@ import org.dive4elements.river.model.NamedMainValue; import org.dive4elements.river.model.OfficialLine; import org.dive4elements.river.model.River; +import org.dive4elements.river.model.TimeInterval; import org.dive4elements.river.model.Wst; import org.dive4elements.river.model.WstColumn; @@ -46,6 +48,8 @@ private int wstId; private int columnPos; private String name; + private String source; + private Date date; public ValueRange( double start, @@ -53,13 +57,17 @@ double value, int wstId, int columnPos, - String name + String name, + String source, + Date date ) { super(start, end); this.value = value; this.wstId = wstId; this.columnPos = columnPos; this.name = name; + this.source = source; + this.date = date; } public boolean sameValue(double value) { @@ -82,6 +90,14 @@ return name; } + public String getSource() { + return source; + } + + public Date getDate() { + return date; + } + @Override public boolean equals(Object o) { if (!(o instanceof ValueRange)) { @@ -96,7 +112,9 @@ return "[" + name + " value: " + value + " wstId: " + wstId + - " pos: " + columnPos + "]"; + " pos: " + columnPos + + " source: " + source + + " date: " + date +"]"; } } @@ -132,10 +150,13 @@ new HashMap>(); for (OfficialLine line: OfficialLine.fetchAllOfficalLines()) { - NamedMainValue nmv = line.getNamedMainValue(); - Integer mnvId = nmv.getId(); - WstColumn wc = line.getWstColumn(); - Wst wst = wc.getWst(); + NamedMainValue nmv = line.getNamedMainValue(); + Integer mnvId = nmv.getId(); + WstColumn wc = line.getWstColumn(); + Wst wst = wc.getWst(); + TimeInterval ti = wc.getTimeInterval(); + Date date = ti != null ? ti.getStartTime() : null; + String source = wc.getSource(); List ranges = new ArrayList(); @@ -154,7 +175,8 @@ int wstId = wst.getId(); int pos = wc.getPosition(); ValueRange range = new ValueRange( - from, to, value, wstId, pos, nmv.getName()); + from, to, value, wstId, pos, + nmv.getName(), source, date); if (debug) { log.debug( diff -r b2eab164a441 -r 1e6bd2831280 artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelState.java Fri Jun 28 19:24:46 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelState.java Fri Jun 28 20:20:14 2013 +0200 @@ -8,6 +8,7 @@ package org.dive4elements.river.artifacts.states; +import java.util.Date; import java.util.List; import org.apache.log4j.Logger; @@ -125,8 +126,8 @@ report.addProblem(Resources.format( cc.getMeta(), "official.line.found", - "Found official line for {0}.", - ol.getName())); + "Found official line for {0} from year {1,date,yyyy} from {2}.", + ol.getName(), nn(ol.getDate()), nn(ol.getSource()))); } } @@ -137,6 +138,13 @@ return res; } + private static final String nn(String s) { + return s != null ? s : ""; + } + + private static final Date nn(Date d) { + return d != null ? d : new Date(); + } /** * @param context Ignored. diff -r b2eab164a441 -r 1e6bd2831280 artifacts/src/main/resources/messages.properties --- a/artifacts/src/main/resources/messages.properties Fri Jun 28 19:24:46 2013 +0200 +++ b/artifacts/src/main/resources/messages.properties Fri Jun 28 20:20:14 2013 +0200 @@ -436,7 +436,7 @@ wsplgen.job.queued = WSPLGEN job in queue. wsplgen.job.error = An unexpected error while starting WSPLGEN occured. -official.line.found = Found official line for {0}. +official.line.found = Found official line for {0} from year {1,date,yyyy} from {2}. wsp.selected.string = {0} diff -r b2eab164a441 -r 1e6bd2831280 artifacts/src/main/resources/messages_de.properties --- a/artifacts/src/main/resources/messages_de.properties Fri Jun 28 19:24:46 2013 +0200 +++ b/artifacts/src/main/resources/messages_de.properties Fri Jun 28 20:20:14 2013 +0200 @@ -436,7 +436,7 @@ wsplgen.job.queued = WSPLGEN Berechnung befindet sich in Warteschlange. wsplgen.job.error = Ein unerwarteter Fehler beim Starten von WSPLGEN ist aufgetreten. -official.line.found = Es existiert eine amtliche Festlegung f\u00fcr {0}. +official.line.found = F\u00fcr {0} existiert eine amtlich festgelegte Wasserspiegellage aus dem Jahr {1,date,yyyy} von {2}. wsp.selected.string = {0} diff -r b2eab164a441 -r 1e6bd2831280 artifacts/src/main/resources/messages_de_DE.properties --- a/artifacts/src/main/resources/messages_de_DE.properties Fri Jun 28 19:24:46 2013 +0200 +++ b/artifacts/src/main/resources/messages_de_DE.properties Fri Jun 28 20:20:14 2013 +0200 @@ -433,7 +433,7 @@ wsplgen.job.queued = WSPLGEN Berechnung befindet sich in Warteschlange. wsplgen.job.error = Ein unerwarteter Fehler beim Starten von WSPLGEN ist aufgetreten. -official.line.found = Es existiert eine amtliche Festlegung f\u00fcr {0}. +official.line.found = F\u00fcr {0} existiert eine amtlich festgelegte Wasserspiegellage aus dem Jahr {1,date,yyyy} von {2}. wsp.selected.string = {0} diff -r b2eab164a441 -r 1e6bd2831280 artifacts/src/main/resources/messages_en.properties --- a/artifacts/src/main/resources/messages_en.properties Fri Jun 28 19:24:46 2013 +0200 +++ b/artifacts/src/main/resources/messages_en.properties Fri Jun 28 20:20:14 2013 +0200 @@ -438,7 +438,7 @@ wsplgen.job.queued = WSPLGEN job in queue. wsplgen.job.error = An unexpected error while starting WSPLGEN occured. -official.line.found = Found official line for {0}. +official.line.found = Found official line for {0} from year {1,date,yyyy} from {2}. wsp.selected.string = {0}