changeset 1150:5f53b443d67c

Implement getArtifact(uuid,context) in FLYSUtils. flys-artifacts/trunk@2681 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 09 Sep 2011 10:01:09 +0000
parents 64b465699a24
children 08048bd090e6
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java
diffstat 2 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Sep 08 14:42:36 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Sep 09 10:01:09 2011 +0000
@@ -1,3 +1,10 @@
+2011-09-08  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	Implement getArtifact(uuid,context) in FLYSUtils.
+
+	* src/main/java/de/intevation/flys/utils/FLYSUtils.java (getArtifact):
+	  Added implementation, partially resolving a TODO. Added logger instance.
+
 2011-09-08  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/WSPLGENCalculation.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Thu Sep 08 14:42:36 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Fri Sep 09 10:01:09 2011 +0000
@@ -1,5 +1,7 @@
 package de.intevation.flys.utils;
 
+import org.apache.log4j.Logger;
+ 
 import java.util.HashMap;
 import java.util.Map;
 
@@ -20,6 +22,9 @@
 
 public class FLYSUtils {
 
+    /** The logger that is used in this utility. */
+    private static Logger logger = Logger.getLogger(FLYSUtils.class);
+
     public static enum KM_MODE { RANGE, LOCATIONS, NONE };
 
     public static final String XPATH_RIVER_PROJECTION =
@@ -49,10 +54,14 @@
 
 
     public static FLYSArtifact getArtifact(String uuid, CallContext context) {
-        // TODO IMPLEMENT ME
-        // Fetch artifact based on its UUID from ArtifactDatabase
-
-        return null;
+        try {
+            return (FLYSArtifact) context.getDatabase().getRawArtifact(uuid);
+        }
+        // TODO: catch more selective
+        catch (Exception e) {
+            logger.error("Cannot get FLYSArtifact " + uuid + " from database (" + e.getMessage() + ").");
+            return null;
+        }
     }
 
 

http://dive4elements.wald.intevation.org