diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 5377:a5f5599f6fd5 2.9.14

merge
author Bettina Gruenbauer <bettina@intevation.de>
date Fri, 22 Mar 2013 11:02:08 +0100
parents 92c07d5c433c
children a916e1202f0f
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java	Fri Mar 22 11:01:31 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java	Fri Mar 22 11:02:08 2013 +0100
@@ -75,6 +75,7 @@
             });
     }
 
+
     /**
      * Trivial Constructor.
      */
@@ -126,28 +127,44 @@
                     "facet.discharge_curves.mainvalues.q",
                     "facet.discharge_curves.mainvalues.q"),
                 true);
+            Facet qfacet3 = new MainValuesQFacet(
+                HISTORICAL_DISCHARGE_MAINVALUES_Q,
+                Resources.getMsg(
+                    callMeta,
+                    "historical_discharge.mainvalues.q",
+                    "historical_discharge.mainvalues.q"),
+                false);
 
             fs.add(qfacet0);
             fs.add(qfacet1);
             fs.add(qfacet2);
+            fs.add(qfacet3);
         }
         if (!restricted || restriction.endsWith("w")) {
-        Facet wfacet1 = new MainValuesWFacet(
-            COMPUTED_DISCHARGE_MAINVALUES_W,
-            Resources.getMsg(
-                callMeta,
-                "facet.discharge_curves.mainvalues.w",
-                "facet.discharge_curves.mainvalues.w"),
-            false);
-        Facet wfacet2 = new MainValuesWFacet(
-            MAINVALUES_W,
-            Resources.getMsg(
-                callMeta,
-                "facet.discharge_curves.mainvalues.w",
-                "facet.discharge_curves.mainvalues.w"),
-            true);
+            Facet wfacet1 = new MainValuesWFacet(
+                COMPUTED_DISCHARGE_MAINVALUES_W,
+                Resources.getMsg(
+                    callMeta,
+                    "facet.discharge_curves.mainvalues.w",
+                    "facet.discharge_curves.mainvalues.w"),
+                false);
+            Facet wfacet2 = new MainValuesWFacet(
+                MAINVALUES_W,
+                Resources.getMsg(
+                    callMeta,
+                    "facet.discharge_curves.mainvalues.w",
+                    "facet.discharge_curves.mainvalues.w"),
+                true);
+            Facet wfacet3 = new MainValuesWFacet(
+                HISTORICAL_DISCHARGE_MAINVALUES_W,
+                Resources.getMsg(
+                    callMeta,
+                    "historical_discharge.mainvalues.w",
+                    "historical_discharge.mainvalues.w"),
+                true);
             fs.add(wfacet1);
             fs.add(wfacet2);
+            fs.add(wfacet3);
         }
     }
 
@@ -170,6 +187,7 @@
     }
 
 
+    /** Get important data from the 'calling' artifact. */
     @Override
     protected void initialize(Artifact artifact, Object context, CallMeta meta) {
         logger.debug("MainValuesArtifact.initialize");
@@ -186,6 +204,20 @@
             logger.error("No location for mainvalues given.");
         }
         importData(winfo, "river");
+        // In the case of DischargeWQCurves, there are no locations, but a gauge.
+        if (getDataAsString("ld_locations") == null) {
+            // TODO its a tad difficult to remodel Range/Gauge-Access to
+            // do this.
+            String refGaugeID = winfo.getDataAsString("reference_gauge");
+            if (refGaugeID != null) {
+                Gauge g = Gauge.getGaugeByOfficialNumber(Integer.parseInt(refGaugeID));
+                addData("ld_locations", new DefaultStateData("ld_locations", null, null,
+                    String.valueOf(g.getStation())));
+            }
+            else {
+                logger.error("MainValuesArtifact: No location/gauge.");
+            }
+        }
     }
 
 

http://dive4elements.wald.intevation.org