changeset 2740:64dc2997b2dd

Refactor static xpath, other artifacts will come in a later commit. flys-artifacts/trunk@4474 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 23 May 2012 10:04:11 +0000
parents ccc955ef8811
children 0251393f037c
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/AreaArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/HYKArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWQKmsArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java
diffstat 9 files changed, 21 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed May 23 09:40:55 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed May 23 10:04:11 2012 +0000
@@ -1,3 +1,17 @@
+2012-05-23	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java:
+	  Define XPath to access "id" value of element coming from datacage-document.
+
+	* src/main/java/de/intevation/flys/artifacts/HYKArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/AreaArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/GaugeDischargeArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/StaticWQKmsArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java:
+	  Use xpath defined in superclass.
+
 2012-05-23	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/BlackboardDataFacet.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/AreaArtifact.java	Wed May 23 09:40:55 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/AreaArtifact.java	Wed May 23 10:04:11 2012 +0000
@@ -28,9 +28,6 @@
  */
 public class AreaArtifact extends StaticFLYSArtifact {
 
-    /** Access ids of doc. */
-    public static final String XPATH_IDS = "/art:action/art:ids/@value";
-
     /** Name of Artifact. */
     public static final String AREA_ARTIFACT_NAME = "area_artifact";
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java	Wed May 23 09:40:55 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java	Wed May 23 10:04:11 2012 +0000
@@ -38,9 +38,6 @@
  */
 public class CrossSectionArtifact extends StaticFLYSArtifact {
 
-    /** Access ids of doc. */
-    public static final String XPATH_IDS = "/art:action/art:ids/@value";
-
     /** Name of Artifact. */
     public static final String CS_ARTIFACT_NAME = "cross_section";
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeArtifact.java	Wed May 23 09:40:55 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeArtifact.java	Wed May 23 10:04:11 2012 +0000
@@ -19,6 +19,7 @@
 
 import de.intevation.artifacts.common.utils.XMLUtils;
 
+import de.intevation.flys.artifacts.StaticFLYSArtifact;
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.WQKms;
 
@@ -35,7 +36,6 @@
 import de.intevation.flys.utils.FLYSUtils;
 
 
-
 /**
  * Artifact to store user-added points.
  */
@@ -49,9 +49,6 @@
     /** The name of the artifact. */
     public static final String ARTIFACT_NAME = "gaugedischarge";
 
-    // TODO make this one globally available
-    public static final String XPATH_DATA =
-        "/art:action/art:ids/@value";
 
     /**
      * Trivial Constructor.
@@ -78,7 +75,8 @@
         logger.debug("GaugeDischargeArtifact.setup");
         super.setup(identifier, factory, context, callMeta, data);
         String ids = XMLUtils.xpathString(
-            data, XPATH_DATA, ArtifactNamespaceContext.INSTANCE);
+            data, StaticFLYSArtifact.XPATH_IDS,
+            ArtifactNamespaceContext.INSTANCE);
         logger.debug("id for gaugedischarge: " + ids);
 
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/HYKArtifact.java	Wed May 23 09:40:55 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/HYKArtifact.java	Wed May 23 10:04:11 2012 +0000
@@ -24,9 +24,6 @@
  */
 public class HYKArtifact extends StaticFLYSArtifact {
 
-    /** Access ids of doc. */
-    public static final String XPATH_IDS = "/art:action/art:ids/@value";
-
     /** Name of Artifact. */
     public static final String HYK_ARTIFACT_NAME = "hyk";
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java	Wed May 23 09:40:55 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java	Wed May 23 10:04:11 2012 +0000
@@ -28,6 +28,8 @@
     private static final Logger logger =
         Logger.getLogger(StaticFLYSArtifact.class);
 
+    /** Path to 'ids' (data) in doc that comes from datacage. */
+    public static final String XPATH_IDS = "/art:action/art:ids/@value";
 
     /**
      * Create description document which includes outputmodes.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWQKmsArtifact.java	Wed May 23 09:40:55 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWQKmsArtifact.java	Wed May 23 10:04:11 2012 +0000
@@ -39,10 +39,6 @@
     private static Logger logger =
         Logger.getLogger(StaticWQKmsArtifact.class);
 
-    /** XPath to access initial parameter. */
-    public static final String XPATH_DATA =
-        "/art:action/art:ids/@value";
-
     public static final String STATIC_STATE_NAME =
         "state.additional_wqkms.static";
 
@@ -72,7 +68,7 @@
         logger.debug("StaticWQKmsArtiact.setup" + XMLUtils.toString(data));
 
         String code = XMLUtils.xpathString(
-            data, XPATH_DATA, ArtifactNamespaceContext.INSTANCE);
+            data, XPATH_IDS, ArtifactNamespaceContext.INSTANCE);
         addStringData("ids", code);
         if (code != null) {
             String [] parts = code.split("-");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java	Wed May 23 09:40:55 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java	Wed May 23 10:04:11 2012 +0000
@@ -37,8 +37,6 @@
 
     private static final Logger logger = Logger.getLogger(WMSDBArtifact.class);
 
-    public static final String XPATH_IDS = "/art:action/art:ids/@value";
-
     public static final Pattern DB_URL_PATTERN =
         Pattern.compile("(.*)\\/\\/(.*):([0-9]+)\\/([a-zA-Z]+)");
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java	Wed May 23 09:40:55 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java	Wed May 23 10:04:11 2012 +0000
@@ -44,10 +44,6 @@
     private static Logger logger =
         Logger.getLogger(WQKmsInterpolArtifact.class);
 
-    /** XPath to access initial parameter. */
-    public static final String XPATH_DATA =
-        "/art:action/art:ids/@value";
-
     public static final String STATIC_STATE_NAME =
         "state.additional_wqkms.interpol.static";
 
@@ -80,7 +76,7 @@
 
         List<Facet> fs = new ArrayList<Facet>();
         String code = XMLUtils.xpathString(
-            data, XPATH_DATA, ArtifactNamespaceContext.INSTANCE);
+            data, XPATH_IDS, ArtifactNamespaceContext.INSTANCE);
 
         // TODO Go for JSON, one day.
         //ex.: flood_protection-wstv-114-12

http://dive4elements.wald.intevation.org