Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/MinMaxState.java @ 376:d8f3ef441bf2
merged gnv-artifacts/0.3
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:13:47 +0200 |
parents | e964a3d8f7bc |
children | b7bb66440cc8 |
comparison
equal
deleted
inserted
replaced
293:6b0ef2324d02 | 376:d8f3ef441bf2 |
---|---|
1 /** | |
2 * | |
3 */ | |
4 package de.intevation.gnv.state; | |
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.state.describedata.DefaultMinMaxDescribeData; | |
13 import de.intevation.gnv.state.describedata.DescribeData; | |
14 | |
15 /** | |
16 * @author Tim Englich <tim.englich@intevation.de> | |
17 * | |
18 */ | |
19 public class MinMaxState extends StateBase { | |
20 | |
21 /** | |
22 * The UID of this Class | |
23 */ | |
24 private static final long serialVersionUID = -3525903792105187408L; | |
25 /** | |
26 * the logger, used to log exceptions and additonaly information | |
27 */ | |
28 private static Logger log = Logger.getLogger(MinMaxState.class); | |
29 | |
30 /** | |
31 * Constructor | |
32 */ | |
33 public MinMaxState() { | |
34 super(); | |
35 } | |
36 | |
37 /** | |
38 * @see de.intevation.gnv.state.StateBase#purifyResult(java.util.Collection, | |
39 * java.lang.String) | |
40 */ | |
41 @Override | |
42 protected void purifyResult(Collection<Result> result, String uuid) { | |
43 log.debug("MinMaxState.purifyResult"); | |
44 Collection<Object> describeData = this.getDescibeData(uuid); | |
45 if (describeData == null) { | |
46 describeData = new ArrayList<Object>(); | |
47 } | |
48 if (result != null && result.size() == 1) { | |
49 | |
50 Result value = result.iterator().next(); | |
51 DescribeData values = new DefaultMinMaxDescribeData(this.dataName, | |
52 value.getObject("MIN"), | |
53 value.getObject("MAX")); | |
54 log.debug(values.toString()); | |
55 describeData.add(values); | |
56 } else { | |
57 log.warn("Result cannot be handled as MinMax Resultset"); | |
58 } | |
59 this.setDescibeData(uuid, describeData); | |
60 } | |
61 | |
62 } |