comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/SingleInputState.java @ 540:80630520e25a

merged gnv-artifacts/0.4
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:13:49 +0200
parents a6a33ef35809
children 292fbcd5e9ac
comparison
equal deleted inserted replaced
415:9f4a0b990d27 540:80630520e25a
1 /**
2 *
3 */
4 package de.intevation.gnv.state;
5
6 import java.util.ArrayList;
7 import java.util.Collection;
8 import java.util.List;
9
10 import org.apache.log4j.Logger;
11
12 import de.intevation.gnv.geobackend.base.Result;
13 import de.intevation.gnv.state.describedata.DefaultSingleValueDescribeData;
14
15 /**
16 * @author Tim Englich <tim.englich@intevation.de>
17 *
18 */
19 public class SingleInputState extends StateBase {
20
21 /**
22 * the logger, used to log exceptions and additonaly information
23 */
24 private static Logger log = Logger.getLogger(SingleInputState.class);
25
26 /**
27 *
28 */
29 private static final long serialVersionUID = -6169497306324917318L;
30
31 /**
32 * Constructor
33 */
34 public SingleInputState() {
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("SingleInputState.purifyResult");
44 List<Object> describeData = this.getDescibeData(uuid);
45 if (describeData == null) {
46 describeData = new ArrayList<Object>();
47 }
48 String value = null;
49 if (result != null && result.size() == 1) {
50 Result tmpItem = result.iterator().next();
51 value = tmpItem.getObject("MAX").toString();
52 } else {
53 value = "";
54 }
55
56 describeData.add(new DefaultSingleValueDescribeData(
57 this.dataName, value, getID()));
58 this.setDescibeData(uuid, describeData);
59 }
60
61 }

http://dive4elements.wald.intevation.org