Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/transition/MinMaxTransition.java @ 127:f6f0e4ce4a35
merged gnv-artifacts/0.1
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:13:41 +0200 |
parents | 158e89c2263b |
children | 7fb9441dd8af |
comparison
equal
deleted
inserted
replaced
49:94a07d1d9316 | 127:f6f0e4ce4a35 |
---|---|
1 /** | |
2 * | |
3 */ | |
4 package de.intevation.gnv.transition; | |
5 | |
6 import java.util.ArrayList; | |
7 import java.util.Collection; | |
8 | |
9 import org.apache.log4j.Logger; | |
10 | |
11 import de.intevation.gnv.geobackend.base.Result; | |
12 import de.intevation.gnv.transition.describedata.DefaultMinMaxDescribeData; | |
13 import de.intevation.gnv.transition.describedata.DescribeData; | |
14 | |
15 /** | |
16 * @author Tim Englich <tim.englich@intevation.de> | |
17 * | |
18 */ | |
19 public class MinMaxTransition extends TransitionBase { | |
20 | |
21 /** | |
22 * the logger, used to log exceptions and additonaly information | |
23 */ | |
24 private static Logger log = Logger.getLogger(MinMaxTransition.class); | |
25 | |
26 /** | |
27 * Constructor | |
28 */ | |
29 public MinMaxTransition() { | |
30 super(); | |
31 } | |
32 | |
33 /** | |
34 * @see de.intevation.gnv.transition.TransitionBase#purifyResult(java.util.Collection, java.lang.String) | |
35 */ | |
36 @Override | |
37 protected void purifyResult(Collection<Result> result, String uuid) { | |
38 log.debug("MinMaxTransition.purifyResult"); | |
39 if (this.descibeData == null){ | |
40 this.descibeData = new ArrayList<Object>(); | |
41 } | |
42 if (result != null && result.size() == 1){ | |
43 | |
44 Object[] names = this.inputValueNames.toArray(); | |
45 String minName = names[names.length-2].toString(); | |
46 String maxName = names[names.length-1].toString(); | |
47 Result value = result.iterator().next(); | |
48 DescribeData describeData = new DefaultMinMaxDescribeData(minName, maxName,value.getObject("MIN"), value.getObject("MAX")); | |
49 log.debug(describeData.toString()); | |
50 this.descibeData.add(describeData); | |
51 }else{ | |
52 log.warn("Result cannot be handled as MinMax Resultset"); | |
53 } | |
54 | |
55 } | |
56 | |
57 /** | |
58 * @see de.intevation.gnv.transition.Transition#validate() | |
59 */ | |
60 public boolean validate() { | |
61 // TODO: Implement ME | |
62 return true; | |
63 } | |
64 | |
65 } |