Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputStateBase.java @ 626:61f688a69a55
Split up export modes from output modes.
gnv-artifacts/trunk@700 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 23 Feb 2010 11:47:08 +0000 |
parents | 93978859fa9e |
children | f4331a0df032 |
comparison
equal
deleted
inserted
replaced
625:40ead2d2a08d | 626:61f688a69a55 |
---|---|
6 import java.io.OutputStream; | 6 import java.io.OutputStream; |
7 import java.util.ArrayList; | 7 import java.util.ArrayList; |
8 import java.util.Collection; | 8 import java.util.Collection; |
9 import java.util.HashMap; | 9 import java.util.HashMap; |
10 import java.util.Iterator; | 10 import java.util.Iterator; |
11 import java.util.List; | |
11 import java.util.Locale; | 12 import java.util.Locale; |
13 | |
14 import javax.xml.xpath.XPathConstants; | |
12 | 15 |
13 import org.apache.log4j.Logger; | 16 import org.apache.log4j.Logger; |
14 import org.w3c.dom.Document; | 17 import org.w3c.dom.Document; |
15 import org.w3c.dom.Element; | 18 import org.w3c.dom.Element; |
16 import org.w3c.dom.Node; | 19 import org.w3c.dom.Node; |
17 import org.w3c.dom.NodeList; | 20 import org.w3c.dom.NodeList; |
18 | 21 |
19 import de.intevation.artifactdatabase.Config; | 22 import de.intevation.artifactdatabase.Config; |
23 import de.intevation.artifactdatabase.XMLUtils; | |
20 import de.intevation.artifacts.CallContext; | 24 import de.intevation.artifacts.CallContext; |
21 import de.intevation.artifacts.CallMeta; | 25 import de.intevation.artifacts.CallMeta; |
22 import de.intevation.gnv.artifacts.cache.CacheFactory; | 26 import de.intevation.gnv.artifacts.cache.CacheFactory; |
23 import de.intevation.gnv.artifacts.ressource.RessourceFactory; | 27 import de.intevation.gnv.artifacts.ressource.RessourceFactory; |
24 import de.intevation.gnv.geobackend.base.Result; | 28 import de.intevation.gnv.geobackend.base.Result; |
40 public static final String XPATH_OUTPUT_MODE = | 44 public static final String XPATH_OUTPUT_MODE = |
41 "/art:action/art:out/@name"; | 45 "/art:action/art:out/@name"; |
42 | 46 |
43 public static final String XPATH_MIME_TYPE = | 47 public static final String XPATH_MIME_TYPE = |
44 "/art:action/art:out/art:mime-type/@value"; | 48 "/art:action/art:out/art:mime-type/@value"; |
49 | |
50 public static final String XPATH_EXPORTS = | |
51 "exportModes/export"; | |
45 | 52 |
46 /** | 53 /** |
47 * The UID of this Class | 54 * The UID of this Class |
48 */ | 55 */ |
49 private static final long serialVersionUID = -1718732895737303823L; | 56 private static final long serialVersionUID = -1718732895737303823L; |
113 isMultiselect); | 120 isMultiselect); |
114 inputParameters.add(inputValue); | 121 inputParameters.add(inputValue); |
115 } | 122 } |
116 } | 123 } |
117 | 124 |
125 // parse export modes | |
126 List<ExportMode> exportList = null; | |
127 NodeList exports = (NodeList) XMLUtils.xpath( | |
128 currentNode, XPATH_EXPORTS, XPathConstants.NODESET); | |
129 | |
130 if (exports != null) { | |
131 int exportSize = exports.getLength(); | |
132 | |
133 exportList = new ArrayList<ExportMode>(exportSize); | |
134 for (int k = 0; k < exportSize; k++) { | |
135 Element exp = (Element) exports.item(k); | |
136 String expName = exp.getAttribute("name"); | |
137 String expDesc = exp.getAttribute("description"); | |
138 String expMime = exp.getAttribute("mime-type"); | |
139 | |
140 exportList.add( | |
141 new DefaultExportMode(expName, expDesc, expMime)); | |
142 } | |
143 } | |
144 | |
118 OutputMode outputMode = new DefaultOutputMode(name, | 145 OutputMode outputMode = new DefaultOutputMode(name, |
119 description, mimeType, inputParameters); | 146 description, mimeType, inputParameters, exportList); |
120 log.debug(outputMode.toString()); | 147 log.debug(outputMode.toString()); |
121 this.outputModes.add(outputMode); | 148 this.outputModes.add(outputMode); |
122 | 149 |
123 } | 150 } |
124 } | 151 } |
383 key, | 410 key, |
384 value | 411 value |
385 ); | 412 ); |
386 } | 413 } |
387 } | 414 } |
415 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |