Mercurial > dive4elements > river
view 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 |
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 javax.xml.xpath.XPathFunction; import javax.xml.xpath.XPathFunctionException; import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.model.RiverFactory; import org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZoneServerClientXChange; import org.dive4elements.river.model.River; /** * 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 String rivername = (String) args.get(0); if (rivername == null) return null; final River river = RiverFactory.getRiver(rivername); if (river == null) return null; return VegetationZoneServerClientXChange.parseListToDataString(VegetationZoneServerClientXChange.getStandardList(river, this.context)); } }