Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
1062:ee105e5d5ead | 1063:e7c1ebfc2701 |
---|---|
1 package de.intevation.flys.artifacts.states; | 1 package de.intevation.flys.artifacts.states; |
2 | 2 |
3 import java.util.HashMap; | |
3 import java.util.List; | 4 import java.util.List; |
4 import java.util.Map; | 5 import java.util.Map; |
6 | |
7 import javax.xml.xpath.XPathConstants; | |
5 | 8 |
6 import com.vividsolutions.jts.geom.Geometry; | 9 import com.vividsolutions.jts.geom.Geometry; |
7 | 10 |
8 import org.apache.log4j.Logger; | 11 import org.apache.log4j.Logger; |
9 | 12 |
13 import org.w3c.dom.Document; | |
14 | |
10 import de.intevation.artifacts.CallContext; | 15 import de.intevation.artifacts.CallContext; |
11 import de.intevation.artifacts.CallMeta; | 16 import de.intevation.artifacts.CallMeta; |
12 | 17 |
13 import de.intevation.artifacts.common.utils.Config; | 18 import de.intevation.artifacts.common.utils.Config; |
19 import de.intevation.artifacts.common.utils.XMLUtils; | |
14 | 20 |
15 import de.intevation.artifactdatabase.state.Facet; | 21 import de.intevation.artifactdatabase.state.Facet; |
16 | 22 |
17 import de.intevation.flys.model.RiverAxis; | 23 import de.intevation.flys.model.RiverAxis; |
18 | 24 |
29 public static final String I18N_DESCRIPTION = "floodmap.riveraxis"; | 35 public static final String I18N_DESCRIPTION = "floodmap.riveraxis"; |
30 | 36 |
31 public static final String WMS_LAYER_NAME = "riveraxis"; | 37 public static final String WMS_LAYER_NAME = "riveraxis"; |
32 | 38 |
33 public static final String XPATH_RIVER_PROJECTION = | 39 public static final String XPATH_RIVER_PROJECTION = |
34 "/artifact-database/floodmap/river[@name='%RIVER%']/srid/@value"; | 40 "/artifact-database/floodmap/river[@name=$name]/srid/@value"; |
35 | 41 |
36 | 42 |
37 private static final Logger logger = Logger.getLogger(RiverAxisState.class); | 43 private static final Logger logger = Logger.getLogger(RiverAxisState.class); |
38 | 44 |
39 | 45 |
89 logger.debug("River '" + river + "' bounds: " + bounds); | 95 logger.debug("River '" + river + "' bounds: " + bounds); |
90 | 96 |
91 facet.setExtent(bounds); | 97 facet.setExtent(bounds); |
92 } | 98 } |
93 | 99 |
94 String xpath = XPATH_RIVER_PROJECTION.replace("%RIVER%", river); | 100 Map<String, String> variables = new HashMap<String, String>(1); |
95 String srid = Config.getStringXPath(xpath); | 101 variables.put("name", river); |
102 | |
103 Document cfg = Config.getConfig(); | |
104 | |
105 String srid = (String) XMLUtils.xpath( | |
106 cfg, | |
107 XPATH_RIVER_PROJECTION, | |
108 XPathConstants.STRING, | |
109 null, | |
110 variables); | |
111 | |
96 facet.setSrid(srid); | 112 facet.setSrid(srid); |
97 | 113 |
98 facets.add(facet); | 114 facets.add(facet); |
99 | 115 |
100 return null; | 116 return null; |