changeset 140:2f1b87e1a40c

Added formatted Date Handling in getString Method geo-backend/trunk@109 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 21 Sep 2009 15:30:07 +0000
parents 9f2eaefe9dd4
children b02310d7ffee
files geo-backend/Changelog geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/geo-backend/Changelog	Mon Sep 21 11:41:33 2009 +0000
+++ b/geo-backend/Changelog	Mon Sep 21 15:30:07 2009 +0000
@@ -1,3 +1,8 @@
+2009-09-21  Tim Englich  <tim.englich@intevation.de>
+
+    * src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java: 
+      Added formatted Date handling in getString Method
+
 2009-09-21  Tim Englich  <tim.englich@intevation.de>
 
     * src/test/ressources/QueryExecutorTestCase.properties Edited, 
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java	Mon Sep 21 11:41:33 2009 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java	Mon Sep 21 15:30:07 2009 +0000
@@ -7,6 +7,8 @@
 import java.util.GregorianCalendar;
 import java.util.HashMap;
 
+import de.intevation.gnv.geobackend.util.DateUtils;
+
 /**
  * Defaultimplementation of the Interface Result.
  * This Class stores the Attributevalues of one Result.
@@ -83,7 +85,15 @@
      * @see de.intevation.gnv.geobackend.base.Result#getString(java.lang.String)
      */
     public String getString(String columnName) {
-        return this.columnValues.get(columnName).toString();
+        Object o = this.columnValues.get(columnName);
+        if(o instanceof Date){
+            return DateUtils.getPatternedDateAmer((Date)o);
+        }else if (o instanceof GregorianCalendar){
+            Date d = ((GregorianCalendar)o).getTime();
+            return DateUtils.getPatternedDateAmer(d);
+        }else{
+            return this.columnValues.get(columnName).toString();
+        }
     }
 
     /**

http://dive4elements.wald.intevation.org