annotate gnv-artifacts/src/main/java/de/intevation/gnv/transition/MinMaxTransition.java @ 229:a610c0a01afc

Added the Region-Filter to the Workflow of the Artifacttescases to be able to test it automatically. gnv-artifacts/trunk@297 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 06 Nov 2009 10:23:55 +0000
parents ee2d4134d0b3
children 4e8f0fd8ed79
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 /**
207
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 190
diff changeset
22 * The UID of this Class
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 190
diff changeset
23 */
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 190
diff changeset
24 private static final long serialVersionUID = -3525903792105187408L;
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 190
diff changeset
25 /**
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 * 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
27 */
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 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
29
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 /**
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 * Constructor
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 */
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 public MinMaxTransition() {
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 super();
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 115
diff changeset
36
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 /**
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 115
diff changeset
38 * @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
39 * java.lang.String)
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 */
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 @Override
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
42 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
43 log.debug("MinMaxTransition.purifyResult");
207
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 190
diff changeset
44 Collection<Object> describeData = this.getDescibeData(uuid);
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 190
diff changeset
45 if (describeData == null) {
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 190
diff changeset
46 describeData = new ArrayList<Object>();
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 115
diff changeset
48 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
49
190
baaa1618fa27 Changed the displayed-Values as defined in issue47
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
50 String minName = this.dataName;
baaa1618fa27 Changed the displayed-Values as defined in issue47
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
51 String maxName = this.dataName;
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 Result value = result.iterator().next();
207
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 190
diff changeset
53 DescribeData values = new DefaultMinMaxDescribeData(minName,
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 115
diff changeset
54 maxName, value.getObject("MIN"), value.getObject("MAX"));
207
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 190
diff changeset
55 log.debug(values.toString());
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 190
diff changeset
56 describeData.add(values);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 115
diff changeset
57 } else {
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 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
59 }
207
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 190
diff changeset
60 this.setDescibeData(uuid, describeData);
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 }
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 }

http://dive4elements.wald.intevation.org