diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 1771:c62ff9e72cea

Restore mapping of state id to facets (revert, rev 3083 and 3088). flys-artifacts/trunk@3092 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 27 Oct 2011 09:32:05 +0000
parents 5d8b3880a553
children f3be8fa1ec62
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java	Wed Oct 26 12:55:32 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java	Thu Oct 27 09:32:05 2011 +0000
@@ -47,6 +47,9 @@
     /** The name of the artifact. */
     public static final String ARTIFACT_NAME = "mainvalue";
 
+    /** The name of the static state for this artifact. */
+    public static final String STATIC_STATE_NAME = "state.mainvalue.static";
+
     /** One and only state to be in. */
     protected transient State state = null;
 
@@ -72,8 +75,8 @@
     {
         logger.debug("MainValuesArtifact.setup");
         state = new StaticState(
-            "state.mainvalue.static",
-            "state.mainvalue.static");
+            STATIC_STATE_NAME,
+            STATIC_STATE_NAME);
         Facet qfacet = new MainValuesQFacet(Resources.getMsg(
             callMeta,
             "facet.discharge_curves.mainvalues.q",
@@ -82,18 +85,28 @@
             callMeta,
             "facet.discharge_curves.mainvalues.w",
             "facet.discharge_curves.mainvalues.w"));
-        facets.add(qfacet);
-        facets.add(wfacet);
+
+        List<Facet> fs = new ArrayList<Facet>();
+        fs.add(qfacet);
+        fs.add(wfacet);
+
+        facets.put(state.getID(), fs);
         spawnState();
         super.setup(identifier, factory, context, callMeta, data);
     }
 
+
+    /**
+     * Create "the" state.
+     */
     protected State spawnState() {
-        state = new StaticState("state.mainvalue.static", "state.mainvalue.static");
+        state = new StaticState(STATIC_STATE_NAME, STATIC_STATE_NAME);
+        List<Facet> fs = (List<Facet>) facets.get(STATIC_STATE_NAME);
+
         DefaultOutput mainValuesOutput2 = new DefaultOutput(
             "computed_discharge_curve",
             "output.computed_discharge_curve", "image/png",
-            facets,
+            fs,
             "chart");
 
         state.getOutputs().add(mainValuesOutput2);

http://dive4elements.wald.intevation.org