diff gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java @ 232:3d6d89bcbf42

Added special Data-Selection to the ODV-Exports of TimeSeries on TimeSeriesPoints. issue68 gnv-artifacts/trunk@300 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 09 Nov 2009 08:55:01 +0000
parents ee2d4134d0b3
children 6a3a02e004d9
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java	Fri Nov 06 11:12:45 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java	Mon Nov 09 08:55:01 2009 +0000
@@ -17,6 +17,9 @@
 import de.intevation.artifacts.CallMeta;
 import de.intevation.gnv.artifacts.cache.CacheFactory;
 import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.query.QueryExecutor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
 import de.intevation.gnv.transition.exception.TransitionException;
 
 /**
@@ -40,6 +43,8 @@
      * The different Outputmodes which are provided by an OutputTransition
      */
     protected Collection<OutputMode> outputModes = null;
+    
+    protected String queryODVID = null;
 
     /**
      * Constructor
@@ -63,6 +68,9 @@
     public void setup(Node configuration) {
         log.debug("OutputTransitionBase.setup");
         super.setup(configuration);
+        
+        this.queryODVID = Config.getStringXPath(configuration,"queryID-odv");
+        
         NodeList outputModeList = Config.getNodeSetXPath(configuration,
                 "outputsModes/outputsMode");
         if (outputModeList != null) {
@@ -138,6 +146,31 @@
         return null;
     }
     
+    protected Collection<Result> getODVResult(String uuid) {
+        log.debug("OutputTransitionBase.getODVResult");
+        // TODO add Caching? I think it's not nessessary
+        Collection<Result> returnValue = null;
+        if (this.queryODVID != null){
+            try {
+                String[] filterValues = this.generateFilterValuesFromInputData();
+                try {
+                    QueryExecutor queryExecutor = QueryExecutorFactory
+                                                  .getInstance()
+                                                  .getQueryExecutor();
+                    returnValue  = queryExecutor.executeQuery(this.queryODVID,
+                                                              filterValues);
+                } catch (RuntimeException e) {
+                    log.error(e, e);
+                }
+            } catch (QueryException e) {
+                log.error(e, e);
+            }
+        }else{
+            log.warn("No Query for ODV Data is defined.");
+        }
+        return returnValue;
+    }
+    
     protected void removeChartResult(String uuid) {
         log.debug("OutputTransitionBase.getChartResult");
         if (CacheFactory.getInstance().isInitialized()) {

http://dive4elements.wald.intevation.org