Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/transition/MinMaxTransition.java @ 197:bab92ad1165d
Added the required Classes an Configuration for providing VerticalCrossSections
gnv-artifacts/trunk@250 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 20 Oct 2009 13:32:05 +0000 |
parents | baaa1618fa27 |
children | d87347142702 |
rev | line source |
---|---|
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 /** |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 * |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 */ |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 package de.intevation.gnv.transition; |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
6 import java.util.ArrayList; |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
7 import java.util.Collection; |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
8 |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 import org.apache.log4j.Logger; |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.gnv.geobackend.base.Result; |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.gnv.transition.describedata.DefaultMinMaxDescribeData; |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.gnv.transition.describedata.DescribeData; |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
14 |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
15 /** |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
16 * @author Tim Englich <tim.englich@intevation.de> |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
17 * |
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
18 */ |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 public class MinMaxTransition extends TransitionBase { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
20 |
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
21 /** |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
22 * the logger, used to log exceptions and additonaly information |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
23 */ |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
24 private static Logger log = Logger.getLogger(MinMaxTransition.class); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
25 |
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
26 /** |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
27 * Constructor |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
28 */ |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
29 public MinMaxTransition() { |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
30 super(); |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
31 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
32 |
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
33 /** |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
34 * @see de.intevation.gnv.transition.TransitionBase#purifyResult(java.util.Collection, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
35 * java.lang.String) |
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
36 */ |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 @Override |
99
bb45c5097cb6
ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents:
79
diff
changeset
|
38 protected void purifyResult(Collection<Result> result, String uuid) { |
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
39 log.debug("MinMaxTransition.purifyResult"); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
40 if (this.descibeData == null) { |
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
41 this.descibeData = new ArrayList<Object>(); |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
42 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
43 if (result != null && result.size() == 1) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
44 |
190
baaa1618fa27
Changed the displayed-Values as defined in issue47
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
45 String minName = this.dataName; |
baaa1618fa27
Changed the displayed-Values as defined in issue47
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
46 String maxName = this.dataName; |
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
47 Result value = result.iterator().next(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
48 DescribeData describeData = new DefaultMinMaxDescribeData(minName, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
49 maxName, value.getObject("MIN"), value.getObject("MAX")); |
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 log.debug(describeData.toString()); |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
51 this.descibeData.add(describeData); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
52 } else { |
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 log.warn("Result cannot be handled as MinMax Resultset"); |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
54 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
55 |
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
56 } |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 /** |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 * @see de.intevation.gnv.transition.Transition#validate() |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 */ |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 public boolean validate() { |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 // TODO: Implement ME |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
63 return true; |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
64 } |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
65 |
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
66 } |