Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java @ 733:18dc6a99f4f4
Fixed NPE will using StateBase without a given Query.
gnv-artifacts/trunk@771 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Mon, 15 Mar 2010 12:34:40 +0000 |
parents | dde7f51dbe1e |
children | b8c7105f2b94 |
comparison
equal
deleted
inserted
replaced
732:1a0ed4c521bd | 733:18dc6a99f4f4 |
---|---|
1 package de.intevation.gnv.state; | 1 package de.intevation.gnv.state; |
2 | |
3 import de.intevation.artifactdatabase.Config; | |
4 import de.intevation.artifactdatabase.XMLUtils; | |
5 | |
6 import de.intevation.artifacts.ArtifactNamespaceContext; | |
7 import de.intevation.artifacts.CallContext; | |
8 import de.intevation.artifacts.CallMeta; | |
9 | |
10 import de.intevation.gnv.artifacts.cache.CacheFactory; | |
11 | |
12 import de.intevation.gnv.artifacts.ressource.RessourceFactory; | |
13 | |
14 import de.intevation.gnv.geobackend.base.Result; | |
15 | |
16 import de.intevation.gnv.geobackend.base.query.QueryExecutor; | |
17 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory; | |
18 | |
19 import de.intevation.gnv.geobackend.base.query.exception.QueryException; | |
20 | |
21 import de.intevation.gnv.geobackend.util.DateUtils; | |
22 | |
23 import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData; | |
24 import de.intevation.gnv.state.describedata.KeyValueDescibeData; | |
25 import de.intevation.gnv.state.describedata.MinMaxDescribeData; | |
26 import de.intevation.gnv.state.describedata.NamedArrayList; | |
27 import de.intevation.gnv.state.describedata.NamedCollection; | |
28 import de.intevation.gnv.state.describedata.SingleValueDescribeData; | |
29 | |
30 import de.intevation.gnv.state.exception.StateException; | |
31 | |
32 import de.intevation.gnv.utils.ArtifactXMLUtilities; | |
33 import de.intevation.gnv.utils.InputValidator; | |
34 | 2 |
35 import java.util.ArrayList; | 3 import java.util.ArrayList; |
36 import java.util.Arrays; | 4 import java.util.Arrays; |
37 import java.util.Collection; | 5 import java.util.Collection; |
38 import java.util.Date; | 6 import java.util.Date; |
46 import javax.xml.xpath.XPathConstants; | 14 import javax.xml.xpath.XPathConstants; |
47 | 15 |
48 import net.sf.ehcache.Cache; | 16 import net.sf.ehcache.Cache; |
49 | 17 |
50 import org.apache.log4j.Logger; | 18 import org.apache.log4j.Logger; |
51 | |
52 import org.w3c.dom.Document; | 19 import org.w3c.dom.Document; |
53 import org.w3c.dom.Element; | 20 import org.w3c.dom.Element; |
54 import org.w3c.dom.Node; | 21 import org.w3c.dom.Node; |
55 import org.w3c.dom.NodeList; | 22 import org.w3c.dom.NodeList; |
23 | |
24 import de.intevation.artifactdatabase.Config; | |
25 import de.intevation.artifactdatabase.XMLUtils; | |
26 import de.intevation.artifacts.ArtifactNamespaceContext; | |
27 import de.intevation.artifacts.CallContext; | |
28 import de.intevation.artifacts.CallMeta; | |
29 import de.intevation.gnv.artifacts.cache.CacheFactory; | |
30 import de.intevation.gnv.artifacts.ressource.RessourceFactory; | |
31 import de.intevation.gnv.geobackend.base.Result; | |
32 import de.intevation.gnv.geobackend.base.query.QueryExecutor; | |
33 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory; | |
34 import de.intevation.gnv.geobackend.base.query.exception.QueryException; | |
35 import de.intevation.gnv.geobackend.util.DateUtils; | |
36 import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData; | |
37 import de.intevation.gnv.state.describedata.KeyValueDescibeData; | |
38 import de.intevation.gnv.state.describedata.MinMaxDescribeData; | |
39 import de.intevation.gnv.state.describedata.NamedArrayList; | |
40 import de.intevation.gnv.state.describedata.NamedCollection; | |
41 import de.intevation.gnv.state.describedata.SingleValueDescribeData; | |
42 import de.intevation.gnv.state.exception.StateException; | |
43 import de.intevation.gnv.utils.ArtifactXMLUtilities; | |
44 import de.intevation.gnv.utils.InputValidator; | |
56 | 45 |
57 /** | 46 /** |
58 * @author Tim Englich (tim.englich@intevation.de) | 47 * @author Tim Englich (tim.englich@intevation.de) |
59 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) | 48 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) |
60 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) | 49 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) |
245 } | 234 } |
246 | 235 |
247 boolean valid = iv.isInputValid(tmpItem.getValue(), | 236 boolean valid = iv.isInputValid(tmpItem.getValue(), |
248 inputValue.getType()); | 237 inputValue.getType()); |
249 if (valid) { | 238 if (valid) { |
250 String[] desc = getDescriptionForInputData(tmpItem, uuid); | 239 if (this.queryID != null){ |
251 tmpItem.setDescription(desc); | 240 // Query the Description only if it is possible to |
241 // Query data from the Database for this State. | |
242 String[] desc = getDescriptionForInputData(tmpItem, uuid); | |
243 tmpItem.setDescription(desc); | |
244 } | |
252 this.inputData.put(tmpItem.getName(), tmpItem); | 245 this.inputData.put(tmpItem.getName(), tmpItem); |
253 } else { | 246 } else { |
254 String msg = resFactory.getRessource( | 247 String msg = resFactory.getRessource( |
255 locale, | 248 locale, |
256 EXCEPTION_INVALID_INPUT, | 249 EXCEPTION_INVALID_INPUT, |