changeset 567:d9fc58e30a53

Loop through 'Unterkante' 'Oberkante' from service. flys-client/trunk@2114 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 14 Jun 2011 14:19:45 +0000
parents 3ce558193526
children 1d20533a4ae3
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/DistanceInfoServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DistanceInfoObject.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DistanceInfoObjectImpl.java
diffstat 4 files changed, 53 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Tue Jun 14 14:01:08 2011 +0000
+++ b/flys-client/ChangeLog	Tue Jun 14 14:19:45 2011 +0000
@@ -1,3 +1,10 @@
+2011-06-14	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/DistanceInfoServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DistanceInfoObjectImpl.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DistanceInfoObject.java:
+	  Loop through 'Unterkante' 'Oberkante' from service.
+
 2011-06-14  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties:
--- a/flys-client/src/main/java/de/intevation/flys/client/server/DistanceInfoServiceImpl.java	Tue Jun 14 14:01:08 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/DistanceInfoServiceImpl.java	Tue Jun 14 14:19:45 2011 +0000
@@ -131,6 +131,9 @@
      * @return a valid DistanceInfoObject.
      */
     protected DistanceInfoObject buildDistanceInfoObject(Node node) {
+
+        // XXX: Using XPath here is much too expensive. DOM will do!
+
         String desc = XMLUtils.xpathString(
             node, "@art:description", ArtifactNamespaceContext.INSTANCE);
 
@@ -143,13 +146,29 @@
         String riverside = XMLUtils.xpathString(
             node, "@art:riverside", ArtifactNamespaceContext.INSTANCE);
 
+        String bottom = XMLUtils.xpathString(
+            node, "@art:bottom", ArtifactNamespaceContext.INSTANCE);
+
+        String top = XMLUtils.xpathString(
+            node, "@art:top", ArtifactNamespaceContext.INSTANCE);
+
         if (desc != null && from != null) {
             try {
-                return new DistanceInfoObjectImpl(
-                    desc,
-                    new Double(from),
-                    to != null && to.trim().length() > 0 ? new Double(to) : null,
-                    riverside);
+                Double f = new Double(from);
+
+                Double t = to != null && (to=to.trim()).length() > 0
+                    ? new Double(to)
+                    : null;
+
+                Double tp = top != null && (top=top.trim()).length() > 0
+                    ? new Double(top)
+                    : null;
+
+                Double b = bottom != null && (bottom=bottom.trim()).length() > 0
+                    ? new Double(bottom)
+                    : null;
+
+                return new DistanceInfoObjectImpl(desc, f, t, riverside, b, tp);
             }
             catch (NumberFormatException nfe) {
                 System.err.println(nfe.getLocalizedMessage());
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DistanceInfoObject.java	Tue Jun 14 14:01:08 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DistanceInfoObject.java	Tue Jun 14 14:19:45 2011 +0000
@@ -15,5 +15,9 @@
     Double getTo();
 
     String getRiverside();
+
+    Double getBottom();
+
+    Double getTop();
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DistanceInfoObjectImpl.java	Tue Jun 14 14:01:08 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DistanceInfoObjectImpl.java	Tue Jun 14 14:19:45 2011 +0000
@@ -14,6 +14,10 @@
 
     protected String riverside;
 
+    protected Double bottom;
+
+    protected Double top;
+
 
     public DistanceInfoObjectImpl() {
     }
@@ -23,15 +27,18 @@
         String description,
         Double from,
         Double to,
-        String riverside)
-    {
+        String riverside,
+        Double bottom,
+        Double top
+    ) {
         this.description = description;
         this.from        = from;
         this.to          = to;
         this.riverside   = riverside;
+        this.bottom      = bottom;
+        this.top         = top;
     }
 
-
     public String getDescription() {
         return description;
     }
@@ -50,5 +57,13 @@
     public String getRiverside() {
         return riverside;
     }
+
+    public Double getBottom() {
+        return bottom;
+    }
+
+    public Double getTop() {
+        return top;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org