Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java @ 171:7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
gnv-artifacts/trunk@208 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 09 Oct 2009 07:54:48 +0000 |
parents | ef157bd2fa92 |
children | 4896d4f94bdc |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java Fri Oct 09 07:49:47 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java Fri Oct 09 07:54:48 2009 +0000 @@ -21,28 +21,26 @@ /** * @author Tim Englich <tim.englich@intevation.de> - * + * */ public abstract class OutputTransitionBase extends TransitionBase implements - OutputTransition { - - + OutputTransition { + /** * The UID of this Class */ private static final long serialVersionUID = -1718732895737303823L; - + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(OutputTransitionBase.class); - - + /** * The different Outputmodes which are provided by an OutputTransition */ protected Collection<OutputMode> outputModes = null; - + /** * Constructor */ @@ -57,6 +55,7 @@ log.debug("OutputTransitionBase.getOutputModes"); return this.outputModes; } + /** * @see de.intevation.gnv.transition.Transition#validate() */ @@ -72,55 +71,69 @@ public void setup(Node configuration) { log.debug("OutputTransitionBase.setup"); super.setup(configuration); - NodeList outputModeList = Config.getNodeSetXPath(configuration, "outputsModes/outputsMode"); - if (outputModeList != null){ - log.debug(outputModeList.getLength()+ " were found."); - this.outputModes = new ArrayList<OutputMode>(outputModeList.getLength()); - for (int i = 0; i < outputModeList.getLength(); i++){ + NodeList outputModeList = Config.getNodeSetXPath(configuration, + "outputsModes/outputsMode"); + if (outputModeList != null) { + log.debug(outputModeList.getLength() + " were found."); + this.outputModes = new ArrayList<OutputMode>(outputModeList + .getLength()); + for (int i = 0; i < outputModeList.getLength(); i++) { Node currentNode = outputModeList.item(i); - String name = Config.getStringXPath(currentNode, "@name"); - String description = Config.getStringXPath(currentNode, "@description"); - String mimeType = Config.getStringXPath(currentNode, "@mime-type"); - - NodeList inputValuesList = Config.getNodeSetXPath(currentNode, "parameters/inputvalue"); + String name = Config.getStringXPath(currentNode, "@name"); + String description = Config.getStringXPath(currentNode, + "@description"); + String mimeType = Config.getStringXPath(currentNode, + "@mime-type"); + + NodeList inputValuesList = Config.getNodeSetXPath(currentNode, + "parameters/inputvalue"); Collection<InputValue> inputParameters = null; - if (inputValuesList != null){ - inputParameters = new ArrayList<InputValue>(inputValuesList.getLength()); - for (int j = 0 ; j < inputValuesList.getLength(); j++){ + if (inputValuesList != null) { + inputParameters = new ArrayList<InputValue>(inputValuesList + .getLength()); + for (int j = 0; j < inputValuesList.getLength(); j++) { Node currentInputValuesNode = inputValuesList.item(j); - String inputValueName = Config.getStringXPath(currentInputValuesNode, "@name"); - String inputValueType = Config.getStringXPath(currentInputValuesNode, "@type"); - String defaultValue = Config.getStringXPath(currentInputValuesNode, "@value"); + String inputValueName = Config.getStringXPath( + currentInputValuesNode, "@name"); + String inputValueType = Config.getStringXPath( + currentInputValuesNode, "@type"); + String defaultValue = Config.getStringXPath( + currentInputValuesNode, "@value"); boolean isMultiselect = false; - InputValue inputValue = new DefaultInputValue(inputValueName, inputValueType, defaultValue, isMultiselect); + InputValue inputValue = new DefaultInputValue( + inputValueName, inputValueType, defaultValue, + isMultiselect); inputParameters.add(inputValue); } } - - OutputMode outputMode = new DefaultOutputMode(name, description, mimeType,inputParameters); + + OutputMode outputMode = new DefaultOutputMode(name, + description, mimeType, inputParameters); log.debug(outputMode.toString()); this.outputModes.add(outputMode); - + } } } - + /** * @see de.intevation.gnv.transition.TransitionBase#advance() */ @Override - public void advance(String uuid, CallMeta callMeta) throws TransitionException { + public void advance(String uuid, CallMeta callMeta) + throws TransitionException { log.debug("OutputTransitionBase.advance"); - if (this.getChartResult(uuid) == null){ + if (this.getChartResult(uuid) == null) { super.advance(uuid, callMeta); } } /** - * @see de.intevation.gnv.transition.OutputTransition#out(java.lang.String, java.util.Collection, java.io.OutputStream) + * @see de.intevation.gnv.transition.OutputTransition#out(java.lang.String, + * java.util.Collection, java.io.OutputStream) */ public void out(String outputMode, Collection<InputData> inputData, - OutputStream outputStream) throws TransitionException { + OutputStream outputStream) throws TransitionException { } /** @@ -128,26 +141,27 @@ */ protected Collection<Result> getChartResult(String uuid) { log.debug("OutputTransitionBase.getChartResult"); - if (CacheFactory.getInstance().isInitialized()){ - String key = uuid+super.getID(); - log.debug("Hash for Queryelements: "+key); + if (CacheFactory.getInstance().isInitialized()) { + String key = uuid + super.getID(); + log.debug("Hash for Queryelements: " + key); Element value = CacheFactory.getInstance().getCache().get(key); - if (value != null){ - return (Collection<Result>)(value.getObjectValue()); + if (value != null) { + return (Collection<Result>) (value.getObjectValue()); } } return null; } - + /** - * @see de.intevation.gnv.transition.TransitionBase#purifyResult(java.util.Collection, java.lang.String) + * @see de.intevation.gnv.transition.TransitionBase#purifyResult(java.util.Collection, + * java.lang.String) */ @Override protected void purifyResult(Collection<Result> result, String uuid) { log.debug("OutputTransitionBase.purifyResult"); - if (CacheFactory.getInstance().isInitialized()){ - String key = uuid+super.getID(); - log.debug("Hash for Queryelements: "+key); + if (CacheFactory.getInstance().isInitialized()) { + String key = uuid + super.getID(); + log.debug("Hash for Queryelements: " + key); CacheFactory.getInstance().getCache().put(new Element(key, result)); } }