comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 78:969faa37a11b

Added Multiselectsupport for InputValues gnv-artifacts/trunk@94 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Wed, 16 Sep 2009 12:38:24 +0000
parents 0e38f512f7e4
children 1b12021905b9
comparison
equal deleted inserted replaced
77:0e38f512f7e4 78:969faa37a11b
303 } 303 }
304 304
305 305
306 protected Collection<InputData> parseInputData(Document document){ 306 protected Collection<InputData> parseInputData(Document document){
307 log.debug("GNVArtifactBase.parseInputData"); 307 log.debug("GNVArtifactBase.parseInputData");
308 Collection<InputData> returnValue = null; 308 HashMap<String,InputData> returnValue = null;
309 309
310 log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); 310 log.debug(new ArtifactXMLUtilities().writeDocument2String(document));
311 311
312 NodeList inputElemets = (NodeList)XMLUtils.xpath(document, "/action/data/input",XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);//Config.getNodeSetXPath(document, ""); 312 NodeList inputElemets = (NodeList)XMLUtils.xpath(document, "/action/data/input",XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);//Config.getNodeSetXPath(document, "");
313 if(inputElemets != null){ 313 if(inputElemets != null){
314 returnValue = new ArrayList<InputData>(inputElemets.getLength()); 314 returnValue = new HashMap<String,InputData>(inputElemets.getLength());
315 for (int i = 0; i < inputElemets.getLength(); i++){ 315 for (int i = 0; i < inputElemets.getLength(); i++){
316 Node inputDataNode = inputElemets.item(i); 316 Node inputDataNode = inputElemets.item(i);
317 InputData inputData = new DefaultInputData(Config.getStringXPath(inputDataNode,"@name"), Config.getStringXPath(inputDataNode,"@value")); 317 String name = Config.getStringXPath(inputDataNode,"@name");
318 log.debug(inputData.toString()); 318 String value = Config.getStringXPath(inputDataNode,"@value");
319 returnValue.add(inputData); 319
320 } 320 if (returnValue.containsKey(name)){
321 } 321 InputData inputData = returnValue.get(name);
322 return returnValue; 322 inputData.concartValue(value);
323 log.debug(inputData.toString());
324 returnValue.put(name, inputData);
325 }else{
326 InputData inputData = new DefaultInputData(name,value);
327
328 returnValue.put(name,inputData);
329 }
330 }
331 }
332 return returnValue.values();
323 } 333 }
324 /** 334 /**
325 * @see de.intevation.artifactdatabase.DefaultArtifact#out(org.w3c.dom.Document, java.lang.Object) 335 * @see de.intevation.artifactdatabase.DefaultArtifact#out(org.w3c.dom.Document, java.lang.Object)
326 */ 336 */
327 337

http://dive4elements.wald.intevation.org