annotate gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java @ 200:2f6a96610cb9

Changed Configuration Folder to doc/conf gnv-artifacts/trunk@254 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Wed, 21 Oct 2009 10:27:16 +0000
parents 4896d4f94bdc
children 734ac082c8d1
rev   line source
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 /**
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 *
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 */
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 package de.intevation.gnv.transition;
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
6 import java.io.OutputStream;
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7 import java.util.ArrayList;
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8 import java.util.Collection;
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
10 import net.sf.ehcache.Element;
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
11
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 import org.apache.log4j.Logger;
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import org.w3c.dom.Node;
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 import org.w3c.dom.NodeList;
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 import de.intevation.artifactdatabase.Config;
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
17 import de.intevation.artifacts.CallMeta;
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
18 import de.intevation.gnv.artifacts.cache.CacheFactory;
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
19 import de.intevation.gnv.geobackend.base.Result;
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
20 import de.intevation.gnv.transition.exception.TransitionException;
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 /**
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 * @author Tim Englich <tim.englich@intevation.de>
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
24 *
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 */
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 public abstract class OutputTransitionBase extends TransitionBase implements
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
27 OutputTransition {
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
28
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
29 /**
91
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
30 * The UID of this Class
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
31 */
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
32 private static final long serialVersionUID = -1718732895737303823L;
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
33
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 /**
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 * the logger, used to log exceptions and additonaly information
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 */
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 private static Logger log = Logger.getLogger(OutputTransitionBase.class);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
38
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
39 /**
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
40 * The different Outputmodes which are provided by an OutputTransition
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
41 */
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 protected Collection<OutputMode> outputModes = null;
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
43
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 /**
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 * Constructor
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 */
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 public OutputTransitionBase() {
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 super();
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 }
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 /**
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 * @see de.intevation.gnv.transition.OutputTransition#getOutputModes()
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 */
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 public Collection<OutputMode> getOutputModes() {
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 log.debug("OutputTransitionBase.getOutputModes");
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 return this.outputModes;
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
58
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
59 /**
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
60 * @see de.intevation.gnv.transition.Transition#validate()
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
61 */
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
62 public boolean validate() {
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
63 log.debug("OutputTransitionBase.validate");
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
64 return true;
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
65 }
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67 /**
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 * @see de.intevation.gnv.transition.TransitionBase#setup(org.w3c.dom.Node)
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 */
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 @Override
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71 public void setup(Node configuration) {
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 log.debug("OutputTransitionBase.setup");
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 super.setup(configuration);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
74 NodeList outputModeList = Config.getNodeSetXPath(configuration,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
75 "outputsModes/outputsMode");
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
76 if (outputModeList != null) {
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
77 log.debug(outputModeList.getLength() + " were found.");
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
78 this.outputModes = new ArrayList<OutputMode>(outputModeList
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
79 .getLength());
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
80 for (int i = 0; i < outputModeList.getLength(); i++) {
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 Node currentNode = outputModeList.item(i);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
82 String name = Config.getStringXPath(currentNode, "@name");
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
83 String description = Config.getStringXPath(currentNode,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
84 "@description");
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
85 String mimeType = Config.getStringXPath(currentNode,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
86 "@mime-type");
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
87
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
88 NodeList inputValuesList = Config.getNodeSetXPath(currentNode,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
89 "parameters/inputvalue");
91
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
90 Collection<InputValue> inputParameters = null;
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
91 if (inputValuesList != null) {
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
92 inputParameters = new ArrayList<InputValue>(inputValuesList
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
93 .getLength());
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
94 for (int j = 0; j < inputValuesList.getLength(); j++) {
91
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
95 Node currentInputValuesNode = inputValuesList.item(j);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
96 String inputValueName = Config.getStringXPath(
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
97 currentInputValuesNode, "@name");
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
98 String inputValueType = Config.getStringXPath(
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
99 currentInputValuesNode, "@type");
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
100 String defaultValue = Config.getStringXPath(
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
101 currentInputValuesNode, "@value");
91
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
102 boolean isMultiselect = false;
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
103 InputValue inputValue = new DefaultInputValue(
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
104 inputValueName, inputValueType, defaultValue,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
105 isMultiselect);
91
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
106 inputParameters.add(inputValue);
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
107 }
bd284d8306db Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
108 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
109
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
110 OutputMode outputMode = new DefaultOutputMode(name,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
111 description, mimeType, inputParameters);
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 log.debug(outputMode.toString());
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 this.outputModes.add(outputMode);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
114
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115 }
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
116 }
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
117 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
118
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
119 /**
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
120 * @see de.intevation.gnv.transition.TransitionBase#advance()
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
121 */
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
122 @Override
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
123 public void advance(String uuid, CallMeta callMeta)
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
124 throws TransitionException {
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
125 log.debug("OutputTransitionBase.advance");
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
126 if (this.getChartResult(uuid) == null) {
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
127 super.advance(uuid, callMeta);
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
128 }
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
129 }
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
130
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
131 /**
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
132 * @see de.intevation.gnv.transition.OutputTransition#out(java.lang.String,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
133 * java.util.Collection, java.io.OutputStream)
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
134 */
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
135 public void out(String outputMode, Collection<InputData> inputData,
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
136 OutputStream outputStream) throws TransitionException {
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
137 }
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
138
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
139 /**
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
140 * @return
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
141 */
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
142 protected Collection<Result> getChartResult(String uuid) {
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
143 log.debug("OutputTransitionBase.getChartResult");
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
144 if (CacheFactory.getInstance().isInitialized()) {
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
145 String key = uuid + super.getID();
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
146 log.debug("Hash for Queryelements: " + key);
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
147 Element value = CacheFactory.getInstance().getCache().get(key);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
148 if (value != null) {
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
149 return (Collection<Result>) (value.getObjectValue());
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
150 }
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
151 }
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
152 return null;
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
153 }
182
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
154
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
155 protected void removeChartResult(String uuid) {
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
156 log.debug("OutputTransitionBase.getChartResult");
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
157 if (CacheFactory.getInstance().isInitialized()) {
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
158 String key = uuid + super.getID();
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
159 log.debug("Hash for Queryelements: " + key);
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
160 Element value = CacheFactory.getInstance().getCache().get(key);
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
161 if (value != null) {
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
162 CacheFactory.getInstance().getCache().remove(key);
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
163 }
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
164 }
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
165 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
166
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
167 /**
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
168 * @see de.intevation.gnv.transition.TransitionBase#purifyResult(java.util.Collection,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
169 * java.lang.String)
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
170 */
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
171 @Override
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
172 protected void purifyResult(Collection<Result> result, String uuid) {
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
173 log.debug("OutputTransitionBase.purifyResult");
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
174 if (CacheFactory.getInstance().isInitialized()) {
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
175 String key = uuid + super.getID();
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
176 log.debug("Hash for Queryelements: " + key);
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
177 CacheFactory.getInstance().getCache().put(new Element(key, result));
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 91
diff changeset
178 }
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
179 }
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
180
182
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
181 /**
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
182 * @see de.intevation.gnv.transition.TransitionBase#putInputData(java.util.Collection, java.lang.String)
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
183 */
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
184 @Override
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
185 public void putInputData(Collection<InputData> inputData,
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
186 String uuid)
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
187 throws TransitionException {
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
188 log.debug("OutputTransitionBase.putInputData");
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
189 this.removeChartResult(uuid);
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
190 super.putInputData(inputData, uuid);
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
191 }
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
192
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
193 public void out(String outputMode, Collection<InputData> inputData,
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
194 OutputStream outputStream, String uuid, CallMeta callMeta)
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
195 throws TransitionException {
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
196 }
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
197
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
198
4896d4f94bdc Bugfix ChartValues were not Recalculated after feed was called second Time.
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
199
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
200 }

http://dive4elements.wald.intevation.org