Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/DefaultVegetationZoneXPathFunction.java @ 9482:e5cb5efbc43e
standard veg'zone data cage fix
author | gernotbelger |
---|---|
date | Wed, 12 Sep 2018 12:50:28 +0200 |
parents | e2da9c8a7c57 |
children | 853f2dafc16e |
comparison
equal
deleted
inserted
replaced
9481:787fc085459b | 9482:e5cb5efbc43e |
---|---|
8 * documentation coming with Dive4Elements River for details. | 8 * documentation coming with Dive4Elements River for details. |
9 */ | 9 */ |
10 package org.dive4elements.river.artifacts.datacage.templating; | 10 package org.dive4elements.river.artifacts.datacage.templating; |
11 | 11 |
12 import java.util.List; | 12 import java.util.List; |
13 import java.util.UUID; | |
14 | 13 |
15 import javax.xml.xpath.XPathFunction; | 14 import javax.xml.xpath.XPathFunction; |
16 import javax.xml.xpath.XPathFunctionException; | 15 import javax.xml.xpath.XPathFunctionException; |
17 | 16 |
18 import org.dive4elements.artifacts.CallContext; | 17 import org.dive4elements.artifacts.CallContext; |
19 import org.dive4elements.river.artifacts.D4EArtifact; | 18 import org.dive4elements.river.artifacts.model.RiverFactory; |
20 import org.dive4elements.river.artifacts.access.RiverAccess; | |
21 import org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZoneServerClientXChange; | 19 import org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZoneServerClientXChange; |
22 import org.dive4elements.river.utils.RiverUtils; | 20 import org.dive4elements.river.model.River; |
23 | 21 |
24 /** | 22 /** |
25 * Very specialized function that fetches the default vegetation zones for the river specified by an artifact | 23 * Very specialized function that fetches the default vegetation zones for the river specified by an artifact |
26 * | 24 * |
27 * @author Gernot Belger | 25 * @author Gernot Belger |
39 } | 37 } |
40 | 38 |
41 @Override | 39 @Override |
42 public Object evaluate(final List args) throws XPathFunctionException { | 40 public Object evaluate(final List args) throws XPathFunctionException { |
43 | 41 |
44 final UUID uuid = (UUID) args.get(0); | 42 final String rivername = (String) args.get(0); |
45 if (uuid == null) | 43 if (rivername == null) |
46 return null; | 44 return null; |
47 | 45 |
48 final D4EArtifact artifact = RiverUtils.getArtifact(uuid.toString(), this.context); | 46 final River river = RiverFactory.getRiver(rivername); |
47 if (river == null) | |
48 return null; | |
49 | 49 |
50 final RiverAccess access = new RiverAccess(artifact); | 50 return VegetationZoneServerClientXChange.parseListToDataString(VegetationZoneServerClientXChange.getStandardList(river, this.context)); |
51 | |
52 return VegetationZoneServerClientXChange.parseListToDataString(VegetationZoneServerClientXChange.getStandardList(access.getRiver(), this.context)); | |
53 } | 51 } |
54 } | 52 } |