comparison 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
comparison
equal deleted inserted replaced
231:74255064a4c5 232:3d6d89bcbf42
15 15
16 import de.intevation.artifactdatabase.Config; 16 import de.intevation.artifactdatabase.Config;
17 import de.intevation.artifacts.CallMeta; 17 import de.intevation.artifacts.CallMeta;
18 import de.intevation.gnv.artifacts.cache.CacheFactory; 18 import de.intevation.gnv.artifacts.cache.CacheFactory;
19 import de.intevation.gnv.geobackend.base.Result; 19 import de.intevation.gnv.geobackend.base.Result;
20 import de.intevation.gnv.geobackend.base.query.QueryExecutor;
21 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
22 import de.intevation.gnv.geobackend.base.query.exception.QueryException;
20 import de.intevation.gnv.transition.exception.TransitionException; 23 import de.intevation.gnv.transition.exception.TransitionException;
21 24
22 /** 25 /**
23 * @author Tim Englich <tim.englich@intevation.de> 26 * @author Tim Englich <tim.englich@intevation.de>
24 * 27 *
38 41
39 /** 42 /**
40 * The different Outputmodes which are provided by an OutputTransition 43 * The different Outputmodes which are provided by an OutputTransition
41 */ 44 */
42 protected Collection<OutputMode> outputModes = null; 45 protected Collection<OutputMode> outputModes = null;
46
47 protected String queryODVID = null;
43 48
44 /** 49 /**
45 * Constructor 50 * Constructor
46 */ 51 */
47 public OutputTransitionBase() { 52 public OutputTransitionBase() {
61 */ 66 */
62 @Override 67 @Override
63 public void setup(Node configuration) { 68 public void setup(Node configuration) {
64 log.debug("OutputTransitionBase.setup"); 69 log.debug("OutputTransitionBase.setup");
65 super.setup(configuration); 70 super.setup(configuration);
71
72 this.queryODVID = Config.getStringXPath(configuration,"queryID-odv");
73
66 NodeList outputModeList = Config.getNodeSetXPath(configuration, 74 NodeList outputModeList = Config.getNodeSetXPath(configuration,
67 "outputsModes/outputsMode"); 75 "outputsModes/outputsMode");
68 if (outputModeList != null) { 76 if (outputModeList != null) {
69 log.debug(outputModeList.getLength() + " were found."); 77 log.debug(outputModeList.getLength() + " were found.");
70 this.outputModes = new ArrayList<OutputMode>(outputModeList 78 this.outputModes = new ArrayList<OutputMode>(outputModeList
136 } 144 }
137 } 145 }
138 return null; 146 return null;
139 } 147 }
140 148
149 protected Collection<Result> getODVResult(String uuid) {
150 log.debug("OutputTransitionBase.getODVResult");
151 // TODO add Caching? I think it's not nessessary
152 Collection<Result> returnValue = null;
153 if (this.queryODVID != null){
154 try {
155 String[] filterValues = this.generateFilterValuesFromInputData();
156 try {
157 QueryExecutor queryExecutor = QueryExecutorFactory
158 .getInstance()
159 .getQueryExecutor();
160 returnValue = queryExecutor.executeQuery(this.queryODVID,
161 filterValues);
162 } catch (RuntimeException e) {
163 log.error(e, e);
164 }
165 } catch (QueryException e) {
166 log.error(e, e);
167 }
168 }else{
169 log.warn("No Query for ODV Data is defined.");
170 }
171 return returnValue;
172 }
173
141 protected void removeChartResult(String uuid) { 174 protected void removeChartResult(String uuid) {
142 log.debug("OutputTransitionBase.getChartResult"); 175 log.debug("OutputTransitionBase.getChartResult");
143 if (CacheFactory.getInstance().isInitialized()) { 176 if (CacheFactory.getInstance().isInitialized()) {
144 String key = uuid + super.getID(); 177 String key = uuid + super.getID();
145 log.debug("Hash for Queryelements: " + key); 178 log.debug("Hash for Queryelements: " + key);

http://dive4elements.wald.intevation.org