Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/transition/SingleInputTransition.java @ 325:3eff9241ea1e
Refactoring of the Transitionmodel.
Now each Transition is responsible to allocate the Data which is required to describe or feed it.
gnv-artifacts/trunk@390 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 01 Dec 2009 15:58:02 +0000 |
parents | ee2d4134d0b3 |
children |
rev | line source |
---|---|
81
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 /** |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 * |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 */ |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 package de.intevation.gnv.transition; |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
6 import java.util.ArrayList; |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
7 import java.util.Collection; |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
8 |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 import org.apache.log4j.Logger; |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.gnv.geobackend.base.Result; |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.gnv.transition.describedata.DefaultSingleValueDescribeData; |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
13 |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
14 /** |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
15 * @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:
99
diff
changeset
|
16 * |
81
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
17 */ |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
18 public class SingleInputTransition extends TransitionBase { |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
20 /** |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
21 * the logger, used to log exceptions and additonaly information |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
22 */ |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
23 private static Logger log = Logger.getLogger(SingleInputTransition.class); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
24 |
81
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
25 /** |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
26 * |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
27 */ |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
28 private static final long serialVersionUID = -6169497306324917318L; |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
29 |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
30 /** |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
31 * Constructor |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
32 */ |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
33 public SingleInputTransition() { |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
34 } |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
35 |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
36 /** |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
37 * @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:
99
diff
changeset
|
38 * java.lang.String) |
99
bb45c5097cb6
ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
39 */ |
81
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
40 @Override |
99
bb45c5097cb6
ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
41 protected void purifyResult(Collection<Result> result, String uuid) { |
81
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
42 log.debug("SingleInputTransition.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:
171
diff
changeset
|
43 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:
171
diff
changeset
|
44 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:
171
diff
changeset
|
45 describeData = new ArrayList<Object>(); |
81
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 } |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
47 String value = null; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
48 if (result != null && result.size() == 1) { |
81
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
49 Result tmpItem = result.iterator().next(); |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 value = tmpItem.getObject("MAX").toString(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
51 } else { |
81
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
52 value = ""; |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
54 |
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:
171
diff
changeset
|
55 describeData.add(new DefaultSingleValueDescribeData(this.dataName,value)); |
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
56 this.setDescibeData(uuid, describeData); |
81
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 } |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 |
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 } |