Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/RiverAxisState.java @ 1063:e7c1ebfc2701
Repaired xpath expressions for wms srid and background layers that broke after the floodmap config structure changed.
flys-artifacts/trunk@2541 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 24 Aug 2011 07:51:12 +0000 |
parents | c37084f31c84 |
children | adb52a2005e7 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/RiverAxisState.java Tue Aug 23 15:32:33 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/RiverAxisState.java Wed Aug 24 07:51:12 2011 +0000 @@ -1,16 +1,22 @@ package de.intevation.flys.artifacts.states; +import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.xml.xpath.XPathConstants; + import com.vividsolutions.jts.geom.Geometry; import org.apache.log4j.Logger; +import org.w3c.dom.Document; + import de.intevation.artifacts.CallContext; import de.intevation.artifacts.CallMeta; import de.intevation.artifacts.common.utils.Config; +import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifactdatabase.state.Facet; @@ -31,7 +37,7 @@ public static final String WMS_LAYER_NAME = "riveraxis"; public static final String XPATH_RIVER_PROJECTION = - "/artifact-database/floodmap/river[@name='%RIVER%']/srid/@value"; + "/artifact-database/floodmap/river[@name=$name]/srid/@value"; private static final Logger logger = Logger.getLogger(RiverAxisState.class); @@ -91,8 +97,18 @@ facet.setExtent(bounds); } - String xpath = XPATH_RIVER_PROJECTION.replace("%RIVER%", river); - String srid = Config.getStringXPath(xpath); + Map<String, String> variables = new HashMap<String, String>(1); + variables.put("name", river); + + Document cfg = Config.getConfig(); + + String srid = (String) XMLUtils.xpath( + cfg, + XPATH_RIVER_PROJECTION, + XPathConstants.STRING, + null, + variables); + facet.setSrid(srid); facets.add(facet);