Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputStateBase.java @ 815:22c18083225e
Removed compiler warnings while JavaDoc generation.
gnv-artifacts/trunk@900 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 12 Apr 2010 06:59:33 +0000 |
parents | feae2f9d6c6f |
children | 8dc820099306 |
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 |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
3 import de.intevation.artifactdatabase.Config; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
4 import de.intevation.artifactdatabase.XMLUtils; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
5 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
6 import de.intevation.artifacts.CallContext; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
7 import de.intevation.artifacts.CallMeta; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
8 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
9 import de.intevation.gnv.artifacts.cache.CacheFactory; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
10 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
11 import de.intevation.gnv.artifacts.ressource.RessourceFactory; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
12 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
13 import de.intevation.gnv.geobackend.base.Result; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
14 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
15 import de.intevation.gnv.geobackend.base.query.QueryExecutor; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
16 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
17 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
18 import de.intevation.gnv.geobackend.base.query.exception.QueryException; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
19 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
20 import de.intevation.gnv.state.describedata.MinMaxDescribeData; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
21 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
22 import de.intevation.gnv.state.exception.StateException; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
23 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
24 import de.intevation.gnv.utils.InputValidator; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
25 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
26 import java.io.OutputStream; |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
27 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
28 import java.util.ArrayList; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
29 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
|
30 import java.util.HashMap; |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
31 import java.util.Iterator; |
626
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
32 import java.util.List; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
33 import java.util.Locale; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
34 |
626
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
35 import javax.xml.xpath.XPathConstants; |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
36 |
631
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
37 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
|
38 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
39 import org.apache.log4j.Logger; |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
40 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
41 import org.w3c.dom.Document; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
42 import org.w3c.dom.Element; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
43 import org.w3c.dom.Node; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
44 import org.w3c.dom.NodeList; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
45 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 /** |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
47 * This is the default implementation of <code>OutputState</code>. Artifacts |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
48 * having reached this state or a subclass of this state are able to produce |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
49 * some output (e.g. chart, histograms, statistic, etc). |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
50 * |
780
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
779
diff
changeset
|
51 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> |
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
779
diff
changeset
|
52 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
53 * |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
54 */ |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
55 public abstract class OutputStateBase |
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
56 extends StateBase |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
57 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
|
58 { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
59 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
|
60 "/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
|
61 |
639
a94ed2755480
Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
631
diff
changeset
|
62 public static final String XPATH_EXPORT_MODE = |
a94ed2755480
Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
631
diff
changeset
|
63 "/art:action/art:out/art:export/@name"; |
a94ed2755480
Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
631
diff
changeset
|
64 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
65 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
|
66 "/art:action/art:out/art:mime-type/@value"; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
67 |
626
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
68 public static final String XPATH_EXPORTS = |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
69 "exportModes/export"; |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
70 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
71 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 * The UID of this Class |
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 private static final long serialVersionUID = -1718732895737303823L; |
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 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 * the logger, used to log exceptions and additonaly information |
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 private static Logger log = Logger.getLogger(OutputStateBase.class); |
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 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
82 * The different Outputmodes which are provided by an OutputState |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
83 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
84 protected Collection<OutputMode> outputModes = null; |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
85 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
86 protected String queryODVID = null; |
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 * Constructor |
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 public OutputStateBase() { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
92 super(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
93 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
94 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
95 public Collection<OutputMode> getOutputModes() { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
96 log.debug("OutputStateBase.getOutputModes"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
97 return this.outputModes; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
98 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
99 |
815
22c18083225e
Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
100 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
101 @Override |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
102 public void setup(Node configuration) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
103 log.debug("OutputStateBase.setup"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
104 super.setup(configuration); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
105 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
106 this.queryODVID = Config.getStringXPath(configuration,"queryID-odv"); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
107 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
108 NodeList outputModeList = Config.getNodeSetXPath(configuration, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
109 "outputsModes/outputsMode"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
110 if (outputModeList != null) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
111 log.debug(outputModeList.getLength() + " were found."); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
112 this.outputModes = new ArrayList<OutputMode>(outputModeList |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
113 .getLength()); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
114 for (int i = 0; i < outputModeList.getLength(); i++) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
115 Element currentNode = (Element)outputModeList.item(i); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
116 String name = currentNode.getAttribute("name"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
117 String description =currentNode.getAttribute("description"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
118 String mimeType = currentNode.getAttribute("mime-type"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
119 NodeList inputValuesList = Config.getNodeSetXPath(currentNode, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
120 "parameters/inputvalue"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
121 Collection<InputValue> inputParameters = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
122 if (inputValuesList != null) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
123 inputParameters = new ArrayList<InputValue>(inputValuesList |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
124 .getLength()); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
125 for (int j = 0; j < inputValuesList.getLength(); j++) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
126 Element currentInputValuesNode = (Element)inputValuesList.item(j); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
127 String inputValueName = currentInputValuesNode.getAttribute("name"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
128 String inputValueType = currentInputValuesNode.getAttribute("type"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
129 String defaultValue =currentInputValuesNode.getAttribute("value"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
130 boolean isMultiselect = false; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
131 InputValue inputValue = new DefaultInputValue( |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
132 inputValueName, inputValueType, defaultValue, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
133 isMultiselect); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
134 inputParameters.add(inputValue); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
135 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
136 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
137 |
626
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
138 // parse export modes |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
139 List<ExportMode> exportList = null; |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
140 NodeList exports = (NodeList) XMLUtils.xpath( |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
141 currentNode, XPATH_EXPORTS, XPathConstants.NODESET); |
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 if (exports != null) { |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
144 int exportSize = exports.getLength(); |
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 exportList = new ArrayList<ExportMode>(exportSize); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
147 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
|
148 Element exp = (Element) exports.item(k); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
149 String expName = exp.getAttribute("name"); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
150 String expDesc = exp.getAttribute("description"); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
151 String expMime = exp.getAttribute("mime-type"); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
152 |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
153 exportList.add( |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
154 new DefaultExportMode(expName, expDesc, expMime)); |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
155 } |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
156 } |
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
157 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
158 OutputMode outputMode = new DefaultOutputMode(name, |
626
61f688a69a55
Split up export modes from output modes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
616
diff
changeset
|
159 description, mimeType, inputParameters, exportList); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
160 log.debug(outputMode.toString()); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
161 this.outputModes.add(outputMode); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
162 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
163 } |
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 |
815
22c18083225e
Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
167 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
168 @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
|
169 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
|
170 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
|
171 { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
172 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
173 |
815
22c18083225e
Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
174 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
175 @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
|
176 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
|
177 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
|
178 { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
179 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
180 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
181 /** |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
182 * This method needs to be defined by concrete subclasses. Nothing is done |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
183 * here. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
184 */ |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
185 public void out( |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
186 Document format, |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
187 Collection<InputData> inputData, |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
188 OutputStream outputStream, |
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
189 String uuid, |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
190 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
|
191 ) |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
192 throws StateException |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
439
diff
changeset
|
193 { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
194 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
195 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
196 /** |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
197 * This method needs to be defined by concrete subclasses. Nothing is done |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
198 * here. |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
199 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
200 public void out(String outputMode, Collection<InputData> inputData, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
201 OutputStream outputStream) throws StateException { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
202 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
203 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
204 /** |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
205 * Returns the data used to create charts. If a cache is configured, try to |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
206 * fetch the data from cache. The database is queried if the data is not in |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
207 * cache yet, or if no cache is configured. If the cache is configured, but |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
208 * the data is not in cache yet, put it into cache for a faster access |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
209 * in a later time. |
803
feae2f9d6c6f
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
796
diff
changeset
|
210 * |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
211 * @param uuid The uuid of an artifact. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
212 * @param callContext The CallContext. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
213 * @return the chart data. |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
214 */ |
439
8975de9d7483
Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
215 protected Object getChartResult(String uuid, CallContext callContext) { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
216 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
|
217 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
|
218 |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
219 if (factory.isInitialized()) { |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
220 // 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
|
221 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
|
222 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
|
223 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
|
224 |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
225 net.sf.ehcache.Element value = cache.get(key); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
226 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
|
227 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
|
228 return value.getObjectValue(); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
229 } |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
230 else { |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
231 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
|
232 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
|
233 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
|
234 |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
235 return result; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
236 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
237 } |
631
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
238 else { |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
239 // 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
|
240 // single time |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
241 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
|
242 return getData(queryID); |
f4331a0df032
Chart and histogram output are working without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
626
diff
changeset
|
243 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
244 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
245 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
246 /** |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
247 * This method should no longer be used, because it is not good to put a |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
248 * chart into cache. Parameter changes done by the user wouldn't be detected |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
249 * proper. |
803
feae2f9d6c6f
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
796
diff
changeset
|
250 * @deprecated |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
251 */ |
439
8975de9d7483
Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
252 protected Object getChartFromCache(String uuid, CallContext callContext) { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
253 log.debug("Fetch chart [" + uuid + "] from cache"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
254 CacheFactory cacheFactory = CacheFactory.getInstance(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
255 if (cacheFactory.isInitialized()) { |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
256 String key = "chart_" + getHash(); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
257 net.sf.ehcache.Element object = cacheFactory.getCache().get(key); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
258 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
259 if (object != null) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
260 return object.getObjectValue(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
261 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
262 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
263 return null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
264 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
265 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
266 /** |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
267 * Retrieves the data used to create an ODV export. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
268 * |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
269 * @param uuid |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
270 * @return odv data. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
271 */ |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
272 protected Collection<Result> getODVResult(String uuid) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
273 log.debug("OutputStateBase.getODVResult"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
274 // TODO add Caching? I think it's not nessessary |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
275 Collection<Result> returnValue = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
276 if (this.queryODVID != null){ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
277 returnValue = this.getData(this.queryODVID); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
278 }else{ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
279 log.warn("No Query for ODV Data is defined."); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
280 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
281 return returnValue; |
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 /** |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
285 * Retrieve data from database with help of queryID. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
286 * |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
287 * @param queryID A query id defined in sql statements properties file. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
288 * @return some data. |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
289 */ |
616
93978859fa9e
Added the Configuration and the Classes for the new Product Layer.
Tim Englich <tim.englich@intevation.de>
parents:
610
diff
changeset
|
290 protected Collection<Result> getData(String queryID) { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
291 log.debug("OutputStateBase.getData"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
292 Collection<Result> returnValue = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
293 try { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
294 String[] filterValues = this.generateFilterValuesFromInputData(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
295 try { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
296 QueryExecutor queryExecutor = QueryExecutorFactory |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
297 .getInstance() |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
298 .getQueryExecutor(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
299 returnValue = queryExecutor.executeQuery(queryID,filterValues); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
300 } catch (RuntimeException e) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
301 log.error(e, e); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
302 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
303 } catch (QueryException e) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
304 log.error(e, e); |
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 return returnValue; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
307 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
308 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
309 /** |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
310 * This method removes the data used for creating charts from cache. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
311 * |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
312 */ |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
313 protected void removeChartResult(String uuid) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
314 log.debug("OutputStateBase.getChartResult"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
315 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
|
316 String key = "chart_" + getHash(); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
317 log.debug("Hash for Queryelements: " + key); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
318 net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
319 if (value != null) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
320 CacheFactory.getInstance().getCache().remove(key); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
321 } |
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 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
324 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
325 /** |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
326 * This method should no longer be used. It removes a chart from cache. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
327 * |
803
feae2f9d6c6f
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
796
diff
changeset
|
328 * @deprecated |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
329 */ |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
330 protected void removeChart(String uuid) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
331 log.debug("OutputStateBase.removeChart from cache"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
332 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
333 CacheFactory cacheFactory = CacheFactory.getInstance(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
334 if (cacheFactory.isInitialized()) { |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
335 String key = "chart_" + getHash(); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
336 net.sf.ehcache.Element object = cacheFactory.getCache().get(key); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
337 if (object != null) |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
338 cacheFactory.getCache().remove(key); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
339 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
340 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
341 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
342 /** |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
343 * This is an internal method used while database query. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
344 */ |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
345 protected void purifyChart(Object chart, String uuid) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
346 log.debug("Prufify chart [" + uuid + "]"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
347 CacheFactory cacheFactory = CacheFactory.getInstance(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
348 if (cacheFactory.isInitialized()) { |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
349 String key = "chart_" + getHash(); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
350 cacheFactory.getCache().put(new net.sf.ehcache.Element(key, chart)); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
351 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
352 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
353 |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
354 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
355 /** |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
356 * Use this method to feed a state with new data. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
357 */ |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
358 @Override |
725
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
359 public Document feed( |
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
360 CallContext context, |
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
361 Collection<InputData> inputData, |
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
362 String uuid) |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
363 throws StateException |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
364 { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
365 putInputData(inputData, uuid); |
725
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
366 |
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
639
diff
changeset
|
367 return feedSuccess(); |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
368 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
369 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
370 /** |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
371 * This method is used to put new data into a next state. The difference |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
372 * between this method and feed is, that this method should be used to |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
373 * transfer some old input data required by this state. New data need to be |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
374 * inserted via feed! |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
375 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
376 @Override |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
377 @SuppressWarnings({"static-access", "static-access", "static-access", "static-access"}) |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
378 public void putInputData(Collection<InputData> inputData, |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
379 String uuid) |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
380 throws StateException { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
381 log.debug("OutputStateBase.putInputData"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
382 this.removeChartResult(uuid); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
383 this.removeChart(uuid); |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
384 |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
385 if (inputData != null) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
386 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
|
387 InputValidator iv = new InputValidator(); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
388 while (it.hasNext()) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
389 InputData tmpItem = it.next(); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
390 Object tmpObj = tmpItem.getObject(); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
391 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
|
392 if (inputValue != null) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
393 if (this.inputData == null) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
394 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
|
395 inputData.size()); |
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 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
398 @SuppressWarnings("static-access") |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
399 boolean valid = InputValidator.isInputValid(tmpItem.getValue(), |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
400 inputValue.getType()); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
401 if (valid) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
402 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
|
403 String minValue = tmpItem.getValue(); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
404 String maxValue = getInputValue4ID(inputData, MAXVALUEFIELDNAME); |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
405 valid = InputValidator.isInputValid(maxValue,inputValue.getType()); |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
406 if (!valid){ |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
407 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
|
408 + " 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
|
409 + " Value."; |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
410 log.warn(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
411 throw new StateException(errMsg); |
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 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
414 valid = InputValidator.isInputValid(minValue, |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
415 maxValue, |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
416 inputValue.getType()); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
417 if (!valid){ |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
418 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
|
419 log.warn(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
420 throw new StateException(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
421 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
422 }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
|
423 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
|
424 String maxValue = tmpItem.getValue(); |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
425 valid = InputValidator.isInputValid(minValue,inputValue.getType()); |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
426 if (!valid){ |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
427 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
|
428 + " 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
|
429 + " Value."; |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
430 log.warn(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
431 throw new StateException(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
432 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
433 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
434 valid = InputValidator.isInputValid(minValue, |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
435 maxValue, |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
436 inputValue.getType()); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
437 if (!valid){ |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
438 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
|
439 log.warn(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
440 throw new StateException(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
441 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
442 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
443 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
|
444 } else { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
445 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
|
446 + " 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
|
447 + " Value."; |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
448 log.warn(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
449 throw new StateException(errMsg); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
450 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
451 |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
452 } |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
453 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
|
454 MinMaxDescribeData data = (MinMaxDescribeData) tmpObj; |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
455 if (this.inputData == null) { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
456 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
|
457 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
458 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
|
459 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
|
460 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
|
461 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
462 else { |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
463 |
610
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
464 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
|
465 + tmpItem.getName(); |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
466 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
|
467 |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
468 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
469 } |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
470 } else { |
6484464d2059
Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
493
diff
changeset
|
471 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
|
472 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
473 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
474 |
815
22c18083225e
Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
475 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
476 public void out( |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
477 String outputMode, |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
478 Collection<InputData> inputData, |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
479 OutputStream outputStream, |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
480 String uuid, |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
481 CallMeta callMeta) |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
482 throws StateException { } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
483 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
484 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
485 /** |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
486 * Retrieves a message from resource bundle specified by locale. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
487 * |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
488 * @param locale Locale to use. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
489 * @param key The key of the message. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
490 * @param value The default value. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
491 * @return The value. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
492 */ |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
493 protected String getMessage(Locale locale, String key, String value) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
494 return RessourceFactory.getInstance().getRessource( |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
495 locale, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
496 key, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
497 value |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
498 ); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
499 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
500 } |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
501 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |