[Dive4elements-commits] [PATCH] issue1289: Show km station with certain error message

Wald Commits scm-commit at wald.intevation.org
Tue Apr 23 10:33:14 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1366706445 -7200
# Node ID 470460bfb5fca893f96503cd61e1c54ec34ccf9c
# Parent  d38004f0c52fc4a432c156d5a93191df424d96ec
issue1289: Show km station with certain error message.

diff -r d38004f0c52f -r 470460bfb5fc flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java
--- 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.
diff -r d38004f0c52f -r 470460bfb5fc flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation.java
--- 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>();


More information about the Dive4elements-commits mailing list