changeset 5786:470460bfb5fc

issue1289: Show km station with certain error message.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 23 Apr 2013 10:40:45 +0200
parents d38004f0c52f
children 9df65e89195e
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation.java
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Mon Apr 22 17:01:17 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Tue Apr 23 10:40:45 2013 +0200
@@ -252,7 +252,7 @@
             Gauge gauge = river.determineGaugeByPosition(range[0]);
             if (gauge == null) {
                 return error(
-                    new WQKms[0], "no.gauge.found.for.km");
+                    new WQKms[0], "no.gauge.found.for.km", range[0]);
             }
 
             refKm = gauge.getStation().doubleValue();
@@ -416,6 +416,11 @@
         return new CalculationResult(data, new Calculation(msg));
     }
 
+    /** Create CalculationResult with data and message with args. */
+    protected static final CalculationResult error(Object data, String msg, Object ... args) {
+        return new CalculationResult(data, new Calculation(msg, args));
+    }
+
 
     /**
      * Returns the data that is computed by a reference curve computation.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation.java	Mon Apr 22 17:01:17 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation.java	Tue Apr 23 10:40:45 2013 +0200
@@ -92,6 +92,11 @@
         addProblem(msg);
     }
 
+    /** New Calculation with error which can be translated given args. */
+    public Calculation(String msg, Object ... args) {
+        addProblem(msg, args);
+    }
+
     protected List<Problem> checkProblems() {
         if (problems == null) {
             problems = new ArrayList<Problem>();

http://dive4elements.wald.intevation.org