comparison flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java @ 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 da3c3e286c88
children f58be0d661b9
comparison
equal deleted inserted replaced
1149:64b465699a24 1150:5f53b443d67c
1 package de.intevation.flys.utils; 1 package de.intevation.flys.utils;
2 2
3 import org.apache.log4j.Logger;
4
3 import java.util.HashMap; 5 import java.util.HashMap;
4 import java.util.Map; 6 import java.util.Map;
5 7
6 import javax.xml.xpath.XPathConstants; 8 import javax.xml.xpath.XPathConstants;
7 9
18 import de.intevation.flys.artifacts.model.RiverFactory; 20 import de.intevation.flys.artifacts.model.RiverFactory;
19 import de.intevation.flys.model.River; 21 import de.intevation.flys.model.River;
20 22
21 public class FLYSUtils { 23 public class FLYSUtils {
22 24
25 /** The logger that is used in this utility. */
26 private static Logger logger = Logger.getLogger(FLYSUtils.class);
27
23 public static enum KM_MODE { RANGE, LOCATIONS, NONE }; 28 public static enum KM_MODE { RANGE, LOCATIONS, NONE };
24 29
25 public static final String XPATH_RIVER_PROJECTION = 30 public static final String XPATH_RIVER_PROJECTION =
26 "/artifact-database/floodmap/river[@name=$name]/srid/@value"; 31 "/artifact-database/floodmap/river[@name=$name]/srid/@value";
27 32
47 private FLYSUtils() { 52 private FLYSUtils() {
48 } 53 }
49 54
50 55
51 public static FLYSArtifact getArtifact(String uuid, CallContext context) { 56 public static FLYSArtifact getArtifact(String uuid, CallContext context) {
52 // TODO IMPLEMENT ME 57 try {
53 // Fetch artifact based on its UUID from ArtifactDatabase 58 return (FLYSArtifact) context.getDatabase().getRawArtifact(uuid);
54 59 }
55 return null; 60 // TODO: catch more selective
61 catch (Exception e) {
62 logger.error("Cannot get FLYSArtifact " + uuid + " from database (" + e.getMessage() + ").");
63 return null;
64 }
56 } 65 }
57 66
58 67
59 /** 68 /**
60 * Convinience function to retrieve an XPath as string with replaced config 69 * Convinience function to retrieve an XPath as string with replaced config

http://dive4elements.wald.intevation.org