Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 91:bd284d8306db
Added Support for Patameters in OutputModes
gnv-artifacts/trunk@135 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 25 Sep 2009 14:37:10 +0000 |
parents | 6bdef6e590d6 |
children | bb45c5097cb6 |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java Thu Sep 24 15:27:33 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java Fri Sep 25 14:37:10 2009 +0000 @@ -160,7 +160,7 @@ Document result = XMLUtils.newDocument(); try { if (this.current != null){ - this.current.putInputData(this.parseInputData(target)); + this.current.putInputData(this.parseInputData(target, "/action/data/input")); result = new ArtifactXMLUtilities().createSuccessReport("Feed success", XMLUtils.newDocument()); }else{ String msg = "No Transition instantiated"; @@ -308,6 +308,21 @@ outputModeNode.setAttribute("description", outputMode.getDescription()); outputModeNode.setAttribute("mime-type", outputMode.getMimeType()); outputsNode.appendChild(outputModeNode); + + Collection<InputValue> inputParameters = outputMode.getInputParameters(); + if (inputParameters != null){ + Element inputParametersNode = xmlUtilities.createArtifactElement(document,"parameter"); + outputModeNode.appendChild(inputParametersNode); + Iterator<InputValue> it2 = inputParameters.iterator(); + while (it2.hasNext()){ + InputValue inputValue = it2.next(); + Element inputParameterNode = xmlUtilities.createArtifactElement(document,"parameter"); + inputParametersNode.appendChild(inputParameterNode); + inputParameterNode.setAttribute("name", inputValue.getName()); + inputParameterNode.setAttribute("type", inputValue.getType()); + inputParameterNode.setAttribute("value", inputValue.getDefaultValue()); + } + } } }else{ log.warn("No Outputmodes given."); @@ -317,13 +332,13 @@ } - protected Collection<InputData> parseInputData(Document document){ + protected Collection<InputData> parseInputData(Document document, String xPath){ log.debug("GNVArtifactBase.parseInputData"); HashMap<String,InputData> returnValue = null; log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); - NodeList inputElemets = (NodeList)XMLUtils.xpath(document, "/action/data/input",XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);//Config.getNodeSetXPath(document, ""); + NodeList inputElemets = (NodeList)XMLUtils.xpath(document, xPath,XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);//Config.getNodeSetXPath(document, ""); if(inputElemets != null){ returnValue = new HashMap<String,InputData>(inputElemets.getLength()); for (int i = 0; i < inputElemets.getLength(); i++){ @@ -360,7 +375,7 @@ try { if (current != null && current instanceof OutputTransition){ - ((OutputTransition)current).out(this.readOutputType(format), outputStream); + ((OutputTransition)current).out(this.readOutputType(format),this.parseInputData(format, "/action/out/params/input"), outputStream); context.afterCall(CallContext.STORE); // TODO: FIXME Schmutzige Lösung: Besser einen weiteren Transitionsschritt zwischenschalten. } } catch (TransitionException e) { @@ -369,6 +384,7 @@ } } + protected String readOutputType(Document document){ String value = Config.getStringXPath(document,"action/out/@name"); return value;