Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputStateBase.java @ 756:1614b27dcbfa
Added Support of Layers which are Joined from two Tables.
gnv-artifacts/trunk@804 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 19 Mar 2010 12:12:10 +0000 |
parents | dde7f51dbe1e |
children | 9a828e5a2390 |
rev | line source |
---|---|
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.state; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 import java.io.OutputStream; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 import java.util.ArrayList; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 import java.util.Collection; |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
6 import java.util.HashMap; |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
7 import java.util.Iterator; |
626
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
8 import java.util.List; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 import java.util.Locale; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 |
626
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
11 import javax.xml.xpath.XPathConstants; |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
12 |
631
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
13 import net.sf.ehcache.Cache; |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
14 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
15 import org.apache.log4j.Logger; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
16 import org.w3c.dom.Document; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
17 import org.w3c.dom.Element; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
18 import org.w3c.dom.Node; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 import org.w3c.dom.NodeList; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
20 |
616
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
21 import de.intevation.artifactdatabase.Config; |
626
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
22 import de.intevation.artifactdatabase.XMLUtils; |
616
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
23 import de.intevation.artifacts.CallContext; |
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
24 import de.intevation.artifacts.CallMeta; |
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
25 import de.intevation.gnv.artifacts.cache.CacheFactory; |
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
26 import de.intevation.gnv.artifacts.ressource.RessourceFactory; |
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
27 import de.intevation.gnv.geobackend.base.Result; |
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
28 import de.intevation.gnv.geobackend.base.query.QueryExecutor; |
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
29 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory; |
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
30 import de.intevation.gnv.geobackend.base.query.exception.QueryException; |
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
31 import de.intevation.gnv.state.describedata.MinMaxDescribeData; |
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
32 import de.intevation.gnv.state.exception.StateException; |
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
33 import de.intevation.gnv.utils.InputValidator; |
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
34 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
35 /** |
725
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
36 * @author Tim Englich (tim.englich@intevation.de) |
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
37 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
38 * |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
39 */ |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
40 public abstract class OutputStateBase |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
41 extends StateBase |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
42 implements OutputState |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
43 { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
44 public static final String XPATH_OUTPUT_MODE = |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
45 "/art:action/art:out/@name"; |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
46 |
639
a94ed2755480
Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
631
diff
changeset
|
47 public static final String XPATH_EXPORT_MODE = |
a94ed2755480
Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
631
diff
changeset
|
48 "/art:action/art:out/art:export/@name"; |
a94ed2755480
Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
631
diff
changeset
|
49 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
50 public static final String XPATH_MIME_TYPE = |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
51 "/art:action/art:out/art:mime-type/@value"; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
52 |
626
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
53 public static final String XPATH_EXPORTS = |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
54 "exportModes/export"; |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
55 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
56 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 * The UID of this Class |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 private static final long serialVersionUID = -1718732895737303823L; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 * the logger, used to log exceptions and additonaly information |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
63 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
64 private static Logger log = Logger.getLogger(OutputStateBase.class); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
65 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
66 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
67 * The different Outputmodes which are provided by an OutputState |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
68 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
69 protected Collection<OutputMode> outputModes = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
70 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
71 protected String queryODVID = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
74 * Constructor |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
75 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
76 public OutputStateBase() { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 super(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
78 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
79 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
80 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
81 * @see de.intevation.gnv.state.OutputState#getOutputModes() |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
82 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
83 public Collection<OutputMode> getOutputModes() { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
84 log.debug("OutputStateBase.getOutputModes"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
85 return this.outputModes; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
86 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
88 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
89 * @see de.intevation.gnv.state.StateBase#setup(org.w3c.dom.Node) |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
90 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
91 @Override |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
92 public void setup(Node configuration) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
93 log.debug("OutputStateBase.setup"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
94 super.setup(configuration); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
95 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
96 this.queryODVID = Config.getStringXPath(configuration,"queryID-odv"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
97 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
98 NodeList outputModeList = Config.getNodeSetXPath(configuration, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
99 "outputsModes/outputsMode"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
100 if (outputModeList != null) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
101 log.debug(outputModeList.getLength() + " were found."); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
102 this.outputModes = new ArrayList<OutputMode>(outputModeList |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
103 .getLength()); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
104 for (int i = 0; i < outputModeList.getLength(); i++) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
105 Element currentNode = (Element)outputModeList.item(i); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
106 String name = currentNode.getAttribute("name"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
107 String description =currentNode.getAttribute("description"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
108 String mimeType = currentNode.getAttribute("mime-type"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
109 NodeList inputValuesList = Config.getNodeSetXPath(currentNode, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
110 "parameters/inputvalue"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
111 Collection<InputValue> inputParameters = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
112 if (inputValuesList != null) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
113 inputParameters = new ArrayList<InputValue>(inputValuesList |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
114 .getLength()); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
115 for (int j = 0; j < inputValuesList.getLength(); j++) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
116 Element currentInputValuesNode = (Element)inputValuesList.item(j); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
117 String inputValueName = currentInputValuesNode.getAttribute("name"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
118 String inputValueType = currentInputValuesNode.getAttribute("type"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
119 String defaultValue =currentInputValuesNode.getAttribute("value"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
120 boolean isMultiselect = false; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
121 InputValue inputValue = new DefaultInputValue( |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
122 inputValueName, inputValueType, defaultValue, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
123 isMultiselect); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
124 inputParameters.add(inputValue); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
125 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
126 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
127 |
626
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
128 // parse export modes |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
129 List<ExportMode> exportList = null; |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
130 NodeList exports = (NodeList) XMLUtils.xpath( |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
131 currentNode, XPATH_EXPORTS, XPathConstants.NODESET); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
132 |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
133 if (exports != null) { |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
134 int exportSize = exports.getLength(); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
135 |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
136 exportList = new ArrayList<ExportMode>(exportSize); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
137 for (int k = 0; k < exportSize; k++) { |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
138 Element exp = (Element) exports.item(k); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
139 String expName = exp.getAttribute("name"); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
140 String expDesc = exp.getAttribute("description"); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
141 String expMime = exp.getAttribute("mime-type"); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
142 |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
143 exportList.add( |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
144 new DefaultExportMode(expName, expDesc, expMime)); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
145 } |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
146 } |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
147 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
148 OutputMode outputMode = new DefaultOutputMode(name, |
626
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
149 description, mimeType, inputParameters, exportList); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
150 log.debug(outputMode.toString()); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
151 this.outputModes.add(outputMode); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
152 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
153 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
154 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
155 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
156 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
157 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
158 * @see de.intevation.gnv.state.StateBase#advance() |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
159 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
160 @Override |
493
cef17cc90fd0
Changed some method signatures of the State interface. Use CallContext objects instead of CallMeta objects which are a subset of CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
480
diff
changeset
|
161 public void advance(String uuid, CallContext context) |
cef17cc90fd0
Changed some method signatures of the State interface. Use CallContext objects instead of CallMeta objects which are a subset of CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
480
diff
changeset
|
162 throws StateException |
cef17cc90fd0
Changed some method signatures of the State interface. Use CallContext objects instead of CallMeta objects which are a subset of CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
480
diff
changeset
|
163 { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
164 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
165 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
166 @Override |
493
cef17cc90fd0
Changed some method signatures of the State interface. Use CallContext objects instead of CallMeta objects which are a subset of CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
480
diff
changeset
|
167 public void initialize(String uuid, CallContext context) |
cef17cc90fd0
Changed some method signatures of the State interface. Use CallContext objects instead of CallMeta objects which are a subset of CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
480
diff
changeset
|
168 throws StateException |
cef17cc90fd0
Changed some method signatures of the State interface. Use CallContext objects instead of CallMeta objects which are a subset of CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
480
diff
changeset
|
169 { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
170 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
171 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
172 public void out( |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
173 Document format, |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
174 Collection<InputData> inputData, |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
175 OutputStream outputStream, |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
176 String uuid, |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
177 CallMeta callMeta |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
178 ) |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
179 throws StateException |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
180 { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
181 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
182 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
183 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
184 * @see de.intevation.gnv.state.OutputState#out(java.lang.String, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
185 * java.util.Collection, java.io.OutputStream) |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
186 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
187 public void out(String outputMode, Collection<InputData> inputData, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
188 OutputStream outputStream) throws StateException { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
189 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
190 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
191 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
192 * @return |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
193 */ |
439
8975de9d7483
Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
194 protected Object getChartResult(String uuid, CallContext callContext) { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
195 log.debug("OutputStateBase.getChartResult"); |
631
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
196 CacheFactory factory = CacheFactory.getInstance(); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
197 |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
198 if (factory.isInitialized()) { |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
199 // we use a cache |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
200 log.info("Using cache."); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
201 Cache cache = factory.getCache(); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
202 String key = "chart_" + getHash(); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
203 |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
204 net.sf.ehcache.Element value = cache.get(key); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
205 if (value != null) { |
631
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
206 log.debug("Found element in cache."); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
207 return value.getObjectValue(); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
208 } |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
209 else { |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
210 log.debug("Element not in cache, we need to ask the database"); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
211 Object result = getData(queryID); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
212 cache.put(new net.sf.ehcache.Element(key, result)); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
213 |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
214 return result; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
215 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
216 } |
631
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
217 else { |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
218 // we don't use a cache, so we have to query the database every |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
219 // single time |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
220 log.info("Not using a cache."); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
221 return getData(queryID); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
222 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
223 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
224 |
439
8975de9d7483
Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
225 protected Object getChartFromCache(String uuid, CallContext callContext) { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
226 log.debug("Fetch chart [" + uuid + "] from cache"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
227 CacheFactory cacheFactory = CacheFactory.getInstance(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
228 if (cacheFactory.isInitialized()) { |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
229 String key = "chart_" + getHash(); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
230 net.sf.ehcache.Element object = cacheFactory.getCache().get(key); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
231 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
232 if (object != null) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
233 return object.getObjectValue(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
234 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
235 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
236 return null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
237 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
238 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
239 protected Collection<Result> getODVResult(String uuid) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
240 log.debug("OutputStateBase.getODVResult"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
241 // TODO add Caching? I think it's not nessessary |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
242 Collection<Result> returnValue = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
243 if (this.queryODVID != null){ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
244 returnValue = this.getData(this.queryODVID); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
245 }else{ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
246 log.warn("No Query for ODV Data is defined."); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
247 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
248 return returnValue; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
249 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
250 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
251 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
252 * @param returnValue |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
253 * @return |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
254 */ |
616
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
255 protected Collection<Result> getData(String queryID) { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
256 log.debug("OutputStateBase.getData"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
257 Collection<Result> returnValue = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
258 try { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
259 String[] filterValues = this.generateFilterValuesFromInputData(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
260 try { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
261 QueryExecutor queryExecutor = QueryExecutorFactory |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
262 .getInstance() |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
263 .getQueryExecutor(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
264 returnValue = queryExecutor.executeQuery(queryID,filterValues); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
265 } catch (RuntimeException e) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
266 log.error(e, e); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
267 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
268 } catch (QueryException e) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
269 log.error(e, e); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
270 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
271 return returnValue; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
272 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
273 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
274 protected void removeChartResult(String uuid) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
275 log.debug("OutputStateBase.getChartResult"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
276 if (CacheFactory.getInstance().isInitialized()) { |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
277 String key = "chart_" + getHash(); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
278 log.debug("Hash for Queryelements: " + key); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
279 net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
280 if (value != null) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
281 CacheFactory.getInstance().getCache().remove(key); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
282 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
283 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
284 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
285 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
286 protected void removeChart(String uuid) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
287 log.debug("OutputStateBase.removeChart from cache"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
288 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
289 CacheFactory cacheFactory = CacheFactory.getInstance(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
290 if (cacheFactory.isInitialized()) { |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
291 String key = "chart_" + getHash(); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
292 net.sf.ehcache.Element object = cacheFactory.getCache().get(key); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
293 if (object != null) |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
294 cacheFactory.getCache().remove(key); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
295 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
296 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
297 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
298 protected void purifyChart(Object chart, String uuid) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
299 log.debug("Prufify chart [" + uuid + "]"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
300 CacheFactory cacheFactory = CacheFactory.getInstance(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
301 if (cacheFactory.isInitialized()) { |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
302 String key = "chart_" + getHash(); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
303 cacheFactory.getCache().put(new net.sf.ehcache.Element(key, chart)); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
304 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
305 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
306 |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
307 |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
308 @Override |
725
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
309 public Document feed( |
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
310 CallContext context, |
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
311 Collection<InputData> inputData, |
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
312 String uuid) |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
313 throws StateException |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
314 { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
315 putInputData(inputData, uuid); |
725
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
316 |
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
317 return feedSuccess(); |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
318 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
319 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
320 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
321 * @see de.intevation.gnv.state.StateBase#putInputData(java.util.Collection, java.lang.String) |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
322 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
323 @Override |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
324 public void putInputData(Collection<InputData> inputData, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
325 String uuid) |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
326 throws StateException { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
327 log.debug("OutputStateBase.putInputData"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
328 this.removeChartResult(uuid); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
329 this.removeChart(uuid); |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
330 |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
331 if (inputData != null) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
332 Iterator<InputData> it = inputData.iterator(); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
333 InputValidator iv = new InputValidator(); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
334 while (it.hasNext()) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
335 InputData tmpItem = it.next(); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
336 Object tmpObj = tmpItem.getObject(); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
337 InputValue inputValue = this.inputValues.get(tmpItem.getName()); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
338 if (inputValue != null) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
339 if (this.inputData == null) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
340 this.inputData = new HashMap<String, InputData>( |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
341 inputData.size()); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
342 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
343 |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
344 boolean valid = iv.isInputValid(tmpItem.getValue(), |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
345 inputValue.getType()); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
346 if (valid) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
347 if (tmpItem.getName().equals(MINVALUEFIELDNAME)){ |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
348 String minValue = tmpItem.getValue(); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
349 String maxValue = getInputValue4ID(inputData, MAXVALUEFIELDNAME); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
350 valid = iv.isInputValid(maxValue,inputValue.getType()); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
351 if (!valid){ |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
352 String errMsg = "Wrong input for " + tmpItem.getValue() |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
353 + " is not an " + inputValue.getType() |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
354 + " Value."; |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
355 log.warn(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
356 throw new StateException(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
357 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
358 |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
359 valid = iv.isInputValid(minValue, |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
360 maxValue, |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
361 inputValue.getType()); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
362 if (!valid){ |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
363 String errMsg = "MaxValue-Input is less than MinValue-Input "; |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
364 log.warn(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
365 throw new StateException(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
366 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
367 }else if (tmpItem.getName().equals(MAXVALUEFIELDNAME)){ |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
368 String minValue = getInputValue4ID(inputData, MINVALUEFIELDNAME); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
369 String maxValue = tmpItem.getValue(); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
370 valid = iv.isInputValid(minValue,inputValue.getType()); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
371 if (!valid){ |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
372 String errMsg = "Wrong input for " + tmpItem.getValue() |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
373 + " is not an " + inputValue.getType() |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
374 + " Value."; |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
375 log.warn(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
376 throw new StateException(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
377 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
378 |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
379 valid = iv.isInputValid(minValue, |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
380 maxValue, |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
381 inputValue.getType()); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
382 if (!valid){ |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
383 String errMsg = "MaxValue-Input is less than MinValue-Input "; |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
384 log.warn(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
385 throw new StateException(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
386 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
387 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
388 this.inputData.put(tmpItem.getName(), tmpItem); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
389 } else { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
390 String errMsg = "Wrong input for " + tmpItem.getValue() |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
391 + " is not an " + inputValue.getType() |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
392 + " Value."; |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
393 log.warn(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
394 throw new StateException(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
395 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
396 |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
397 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
398 else if (tmpObj != null && tmpObj instanceof MinMaxDescribeData) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
399 MinMaxDescribeData data = (MinMaxDescribeData) tmpObj; |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
400 if (this.inputData == null) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
401 this.inputData = new HashMap<String, InputData>(inputData.size()); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
402 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
403 this.inputData.put(tmpItem.getName(), tmpItem); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
404 this.inputData.put("minvalue", new DefaultInputData("minvalue", (String) data.getMinValue())); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
405 this.inputData.put("maxvalue", new DefaultInputData("maxvalue", (String) data.getMaxValue())); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
406 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
407 else { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
408 |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
409 String errMsg = "No Inputvalue given for Inputdata " |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
410 + tmpItem.getName(); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
411 log.warn(errMsg + "Value will be ignored"); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
412 |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
413 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
414 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
415 } else { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
416 log.warn("No Inputdata given"); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
417 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
418 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
419 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
420 public void out(String outputMode, Collection<InputData> inputData, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
421 OutputStream outputStream, String uuid, CallMeta callMeta) |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
422 throws StateException { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
423 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
424 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
425 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
426 protected String getMessage(Locale locale, String key, String value) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
427 return RessourceFactory.getInstance().getRessource( |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
428 locale, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
429 key, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
430 value |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
431 ); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
432 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
433 } |
626
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
434 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |