changeset 1703:71d369ab789d

Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen). flys-artifacts/trunk@2945 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 12 Oct 2011 10:21:59 +0000
parents 6f019d1d3da9
children e8627d1e2db6
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/winfo.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java
diffstat 3 files changed, 47 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Oct 11 11:54:14 2011 +0000
+++ b/flys-artifacts/ChangeLog	Wed Oct 12 10:21:59 2011 +0000
@@ -1,3 +1,14 @@
+2011-10-12	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen) .
+
+	* doc/conf/artifacts/winfo.xml: Removed obsolete data of
+	  WDifferencesState.
+
+	* src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java:
+	  Re-enable facet-filtering, but adjust filters before that happens
+	  (former longitudinal_section output is now w_differences output).
+
 2011-10-11	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Added wdiff-chart translations.
--- a/flys-artifacts/doc/conf/artifacts/winfo.xml	Tue Oct 11 11:54:14 2011 +0000
+++ b/flys-artifacts/doc/conf/artifacts/winfo.xml	Wed Oct 12 10:21:59 2011 +0000
@@ -156,7 +156,6 @@
         </state>
 
         <state id="state.winfo.w_differences" description="state.winfo.w_differences" state="de.intevation.flys.artifacts.states.WDifferencesState">
-            <data name="diffids" type="String" />
 
             <outputmodes>
                 <outputmode name="w_differences" description="output.w_differences" mime-type="image/png" type="chart">
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java	Tue Oct 11 11:54:14 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java	Wed Oct 12 10:21:59 2011 +0000
@@ -4,8 +4,11 @@
 import de.intevation.artifactdatabase.state.Output;
 
 import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallMeta;
 
+import de.intevation.artifacts.common.ArtifactNamespaceContext;
+
 import de.intevation.flys.artifacts.states.DefaultState;
 
 import java.util.ArrayList;
@@ -13,9 +16,15 @@
 
 import org.apache.log4j.Logger;
 
+import de.intevation.artifacts.common.utils.XMLUtils;
+import org.w3c.dom.Document;
+
 
 /**
- * Clone of an WINFOArtifact to expose waterlevels only.
+ * Clone of an WINFOArtifact to expose exactly one waterlevel only.
+ * All Facets of the "longitudinal_section" output will be added to the
+ * "w_differences" output and filterFacets adjusted accordingly.
+ *
  * @TODO Straighten inheritance-line (waterlevel-WINFO or vice versa).
  */
 public class WaterlevelArtifact extends WINFOArtifact {
@@ -35,11 +44,31 @@
 
 
     /**
-     * Clone important stuff of an WINFOArtifact (called from factory).
+     * Setup and restate longitudinal_section filterfacets to apply to the
+     * w_differences output, too.
      */
-    protected void initialize(Artifact artifact,
-              Object context,
-              CallMeta meta) {
+    public void setup(
+        String          identifier,
+        ArtifactFactory factory,
+        Object          context,
+        CallMeta        callMeta,
+        Document        data)
+    {
+        super.setup(identifier, factory, context, callMeta, data);
+        filterFacets.put(
+            "w_differences",
+            filterFacets.get("longitudinal_section"));
+    }
+
+    /**
+     * Clone important stuff of an WINFOArtifact.
+     * @param artifact the WINFOArtifact to clone stuff from.
+     */
+    protected void initialize(
+        Artifact artifact,
+        Object context,
+        CallMeta meta)
+    {
         WINFOArtifact winfo = (WINFOArtifact) artifact;
         this.data = winfo.cloneData();
 	logger.debug("Cloned data of winfo artifact.");
@@ -52,18 +81,9 @@
             facets.put(getCurrentStateId(), fs); 
         } 
         else { 
-            logger.debug("No facets to add in WaterlevelArtifact.initialize ("+state.getID()+")."); 
+            logger.debug("No facets to add in WaterlevelArtifact.initialize ("
+                + state.getID() + ").");
         }
-	this.filterFacets = null;
-    }
-
-
-    /**
-     * Prevent filtering from taking place.
-     */
-    @Override
-    protected List<Output> filterOutputs(List<Output> outs) {
-       return outs;
     }
 
 

http://dive4elements.wald.intevation.org