[PATCH] standard veg'zone data cage fix

Wald Commits scm-commit at wald.intevation.org
Wed Sep 12 12:50:32 CEST 2018


# HG changeset patch
# User gernotbelger
# Date 1536749428 -7200
# Node ID e5cb5efbc43e519781980684dab99b118fe35d91
# Parent  787fc085459bd15bec06b4abaeb557ce0b1f7203
standard veg'zone data cage fix

diff -r 787fc085459b -r e5cb5efbc43e artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml	Wed Sep 12 10:55:09 2018 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Wed Sep 12 12:50:28 2018 +0200
@@ -340,7 +340,7 @@
                     <dc:call-macro name="longitudinal-section-prototype" />
                   </dc:when>
                   <dc:when test="$out = 'uinfo.inundation_duration.vegzoneselect'">
-                    <dc:variable name="vegzonedata" expr="dc:defaultvegetationzone()"></dc:variable>
+                    <dc:variable name="vegzonedata" expr="dc:defaultvegetationzone($river)"></dc:variable>
                     <defaultVegetationZone factory="dummy" target_out="{$out}" data="{$vegzonedata}"></defaultVegetationZone>
                   </dc:when>
                   <dc:when test="$out = 'bundu_wspl_longitudinal_section'">
diff -r 787fc085459b -r e5cb5efbc43e artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/DefaultVegetationZoneXPathFunction.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/DefaultVegetationZoneXPathFunction.java	Wed Sep 12 10:55:09 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/DefaultVegetationZoneXPathFunction.java	Wed Sep 12 12:50:28 2018 +0200
@@ -10,16 +10,14 @@
 package org.dive4elements.river.artifacts.datacage.templating;
 
 import java.util.List;
-import java.util.UUID;
 
 import javax.xml.xpath.XPathFunction;
 import javax.xml.xpath.XPathFunctionException;
 
 import org.dive4elements.artifacts.CallContext;
-import org.dive4elements.river.artifacts.D4EArtifact;
-import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.artifacts.model.RiverFactory;
 import org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZoneServerClientXChange;
-import org.dive4elements.river.utils.RiverUtils;
+import org.dive4elements.river.model.River;
 
 /**
  * Very specialized function that fetches the default vegetation zones for the river specified by an artifact
@@ -41,14 +39,14 @@
     @Override
     public Object evaluate(final List args) throws XPathFunctionException {
 
-        final UUID uuid = (UUID) args.get(0);
-        if (uuid == null)
+        final String rivername = (String) args.get(0);
+        if (rivername == null)
             return null;
 
-        final D4EArtifact artifact = RiverUtils.getArtifact(uuid.toString(), this.context);
+        final River river = RiverFactory.getRiver(rivername);
+        if (river == null)
+            return null;
 
-        final RiverAccess access = new RiverAccess(artifact);
-
-        return VegetationZoneServerClientXChange.parseListToDataString(VegetationZoneServerClientXChange.getStandardList(access.getRiver(), this.context));
+        return VegetationZoneServerClientXChange.parseListToDataString(VegetationZoneServerClientXChange.getStandardList(river, this.context));
     }
 }
\ No newline at end of file


More information about the Dive4Elements-commits mailing list