Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/DefaultVegetationZoneXPathFunction.java @ 9403:e2da9c8a7c57
VegetationZone umbenennen
author | gernotbelger |
---|---|
date | Wed, 15 Aug 2018 13:22:00 +0200 |
parents | e511eb935ccd |
children | e5cb5efbc43e |
line wrap: on
line source
/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by * Björnsen Beratende Ingenieure GmbH * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ 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.uinfo.vegetationzones.VegetationZoneServerClientXChange; import org.dive4elements.river.utils.RiverUtils; /** * Very specialized function that fetches the default vegetation zones for the river specified by an artifact * * @author Gernot Belger */ public class DefaultVegetationZoneXPathFunction implements XPathFunction { public static final String ID = "defaultvegetationzone"; public static final int ARITY = 1; private final CallContext context; public DefaultVegetationZoneXPathFunction(final CallContext context) { this.context = context; } @Override public Object evaluate(final List args) throws XPathFunctionException { final UUID uuid = (UUID) args.get(0); if (uuid == null) return null; final D4EArtifact artifact = RiverUtils.getArtifact(uuid.toString(), this.context); final RiverAccess access = new RiverAccess(artifact); return VegetationZoneServerClientXChange.parseListToDataString(VegetationZoneServerClientXChange.getStandardList(access.getRiver(), this.context)); } }