Mercurial > dive4elements > gnv-client
annotate geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java @ 137:d43ff60acda4
Some little performanceimprofments and Bugfixes
geo-backend/trunk@52 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Wed, 09 Sep 2009 15:23:43 +0000 |
parents | 5a583cff97ea |
children | 2f1b87e1a40c |
rev | line source |
---|---|
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 * |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 package de.intevation.gnv.geobackend.base; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
6 import java.util.Date; |
137
d43ff60acda4
Some little performanceimprofments and Bugfixes
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
7 import java.util.GregorianCalendar; |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
8 import java.util.HashMap; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 * Defaultimplementation of the Interface Result. |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
12 * This Class stores the Attributevalues of one Result. |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
13 * @author Tim Englich <tim.englich@intevation.de> |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
14 * |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
15 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
16 public class DefaultResult implements Result { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
17 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
18 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 * HashMap which stores the Columnvalues identified by the unique Columnname |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
20 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
21 private HashMap<String, Object> columnValues = new HashMap<String, Object>(); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
22 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
23 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
24 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
25 * The ResultDescriptor which describes the ColumnValues |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
26 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
27 private ResultDescriptor resultDescriptor = null; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
28 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
29 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
30 * Constructor |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
31 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
32 public DefaultResult(ResultDescriptor resultDescriptor) { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
33 super(); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
34 this.resultDescriptor = resultDescriptor; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
35 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
36 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
38 * @see de.intevation.gnv.geobackend.base.Result#getDate(java.lang.String) |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
39 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
40 public Date getDate(String columnName) { |
137
d43ff60acda4
Some little performanceimprofments and Bugfixes
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
41 Object o = this.columnValues.get(columnName); |
d43ff60acda4
Some little performanceimprofments and Bugfixes
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
42 if(o instanceof Date){ |
d43ff60acda4
Some little performanceimprofments and Bugfixes
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
43 return (Date)o; |
d43ff60acda4
Some little performanceimprofments and Bugfixes
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
44 }else if (o instanceof GregorianCalendar){ |
d43ff60acda4
Some little performanceimprofments and Bugfixes
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
45 return ((GregorianCalendar)o).getTime(); |
d43ff60acda4
Some little performanceimprofments and Bugfixes
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
46 }else{ |
d43ff60acda4
Some little performanceimprofments and Bugfixes
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
47 // TODO FIXME FEHLER finden. |
d43ff60acda4
Some little performanceimprofments and Bugfixes
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
48 return null; |
d43ff60acda4
Some little performanceimprofments and Bugfixes
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
49 } |
d43ff60acda4
Some little performanceimprofments and Bugfixes
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
50 |
d43ff60acda4
Some little performanceimprofments and Bugfixes
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
51 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
52 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
54 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
55 * @see de.intevation.gnv.geobackend.base.Result#getDouble(java.lang.String) |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
56 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 public Double getDouble(String columnName) { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 return (Double)this.columnValues.get(columnName); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 * @see de.intevation.gnv.geobackend.base.Result#getFloat(java.lang.String) |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
63 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
64 public Float getFloat(String columnName) { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
65 return (Float)this.columnValues.get(columnName); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
66 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
67 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
68 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
69 * @see de.intevation.gnv.geobackend.base.Result#getInteger(java.lang.String) |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
70 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
71 public Integer getInteger(String columnName) { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 return (Integer)this.columnValues.get(columnName); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
74 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
75 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
76 * @see de.intevation.gnv.geobackend.base.Result#getResultDescriptor() |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
78 public ResultDescriptor getResultDescriptor() { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
79 return this.resultDescriptor; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
80 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
81 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
82 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
83 * @see de.intevation.gnv.geobackend.base.Result#getString(java.lang.String) |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
84 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
85 public String getString(String columnName) { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
86 return this.columnValues.get(columnName).toString(); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
88 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
89 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
90 * @see de.intevation.gnv.geobackend.base.Result#addColumnValue(java.lang.String, java.lang.Object) |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
91 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
92 public void addColumnValue(String columnName, Object value) { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
93 this.columnValues.put(columnName, value); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
94 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
95 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
96 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
97 * @see de.intevation.gnv.geobackend.base.Result#getObject(java.lang.String) |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
98 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
99 public Object getObject(String columnName) { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
100 return this.columnValues.get(columnName); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
101 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
102 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
103 } |