changeset 9482:e5cb5efbc43e

standard veg'zone data cage fix
author gernotbelger
date Wed, 12 Sep 2018 12:50:28 +0200 (2018-09-12)
parents 787fc085459b
children 992c188b7330
files artifacts/doc/conf/meta-data.xml artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/DefaultVegetationZoneXPathFunction.java
diffstat 2 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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'">
--- 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

http://dive4elements.wald.intevation.org