annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java @ 470:b7bb66440cc8

Added mechanism for advancing to previous states. gnv-artifacts/trunk@533 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 12 Jan 2010 15:25:32 +0000
parents 70df44021a9f
children a6a33ef35809
rev   line source
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 *
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 package de.intevation.gnv.state;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6 import java.util.ArrayList;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7 import java.util.Collection;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8 import java.util.Date;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 import java.util.GregorianCalendar;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 import java.util.HashMap;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11 import java.util.HashSet;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 import java.util.Iterator;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import java.util.List;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 import java.util.Map;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 import java.util.Set;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17 import org.apache.log4j.Logger;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 import org.w3c.dom.Document;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 import org.w3c.dom.Element;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import org.w3c.dom.Node;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 import org.w3c.dom.NodeList;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 import de.intevation.artifactdatabase.Config;
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
24 import de.intevation.artifactdatabase.XMLUtils;
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
25 import de.intevation.artifacts.ArtifactNamespaceContext;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 import de.intevation.artifacts.CallMeta;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 import de.intevation.gnv.artifacts.GNVArtifactBase;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 import de.intevation.gnv.artifacts.cache.CacheFactory;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 import de.intevation.gnv.geobackend.base.Result;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 import de.intevation.gnv.geobackend.base.query.QueryExecutor;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 import de.intevation.gnv.geobackend.base.query.exception.QueryException;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 import de.intevation.gnv.geobackend.util.DateUtils;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 import de.intevation.gnv.state.describedata.MinMaxDescribeData;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 import de.intevation.gnv.state.describedata.NamedArrayList;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39 import de.intevation.gnv.state.describedata.NamedCollection;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 import de.intevation.gnv.state.describedata.SingleValueDescribeData;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 import de.intevation.gnv.state.exception.StateException;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 import de.intevation.gnv.utils.InputValidator;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 * @author Tim Englich <tim.englich@intevation.de>
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
46 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 *
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 public abstract class StateBase implements State {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 * The UID of this Class
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 private static final long serialVersionUID = 2411169179001645426L;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57 * the logger, used to log exceptions and additonaly information
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59 private static Logger log = Logger.getLogger(GNVArtifactBase.class);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 private final static String MINVALUEFIELDNAME = "minvalue";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 private final static String MAXVALUEFIELDNAME = "maxvalue";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 private final static String NODATASELECTIONKEY = "n/n";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 private final static String DESCRIBEDATAKEY = "_DESCRIBEDATA";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 private String id = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 private String description = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 protected String dataName = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 protected boolean dataMultiSelect = false;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 protected boolean dataNoSelect = false;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 protected String queryID = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80 protected Collection<String> inputValueNames = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82 private Map<String, InputValue> inputValues = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 private State parent = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86 protected Map<String, InputData> inputData = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
88
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90 * Constructor
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92 public StateBase() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93 super();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
95
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
96 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97 * @see de.intevation.gnv.state.State#getID()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
98 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
99 public String getID() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
100 return this.id;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104 * @see de.intevation.gnv.state.State#getDescription()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
105 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106 public String getDescription() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 return this.description;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
110
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
111
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 * @see de.intevation.gnv.state.State#getRequiredInputValues()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
114 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115 public Collection<InputValue> getRequiredInputValues() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
116 return this.inputValues.values();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
117 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
118
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
119
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
120 public void reset(String uuid) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
121
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
122 // clear input values of the current state
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
123 Iterator iter = inputValueNames.iterator();
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
124 while (iter.hasNext()) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
125 String name = (String) iter.next();
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
126 inputValues.remove(name);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
127 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
128
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
129 // remove data of last state from cache
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
130 List describeData = getDescibeData(uuid);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
131 if (describeData != null && describeData.size() != 0) {
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
132 describeData.remove(describeData.size()-1);
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
133 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
134 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
135
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
136 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
137 * @see de.intevation.gnv.state.State#setup(org.w3c.dom.Node)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
138 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
139 public void setup(Node configuration) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
140 log.debug("StateBase.setup");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
141 this.id = ((Element)configuration).getAttribute("id");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
142 this.description = ((Element)configuration).getAttribute("description");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
143
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
144 log.info("State-ID = " + this.id);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
145
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
146 NodeList inputValuesNodes = Config.getNodeSetXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
147 "inputvalues/inputvalue");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
148 this.inputValues = new HashMap<String, InputValue>(inputValuesNodes
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
149 .getLength());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
150 this.inputValueNames = new ArrayList<String>(inputValuesNodes
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
151 .getLength());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
152 for (int i = 0; i < inputValuesNodes.getLength(); i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
153 Element inputValueNode = (Element)inputValuesNodes.item(i);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
154 String usedinQueryValue = inputValueNode.getAttribute("usedinquery");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
155 int usedinQuery = 1;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156 if (usedinQueryValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157 try {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
158 usedinQuery = Integer.parseInt(usedinQueryValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
159 } catch (NumberFormatException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160 log
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
161 .warn("Used in Query Value cannot be transformed into a Number");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
162 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
163 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
164 InputValue inputValue = new DefaultInputValue(inputValueNode.getAttribute("name"),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
165 inputValueNode.getAttribute("type"),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
166 Boolean.parseBoolean(inputValueNode.
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
167 getAttribute("multiselect")), usedinQuery);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
168 log.debug(inputValue.toString());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
169 this.inputValues.put(inputValue.getName(), inputValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
170 this.inputValueNames.add(inputValue.getName());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
171 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
172
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
173 this.queryID = Config.getStringXPath(configuration, "queryID");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
174 log.info("QueryID ==> " + this.queryID);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
175
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
176 this.dataName = Config.getStringXPath(configuration, "dataname");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
177
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
178 String dataMultiSelectValue = Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
179 "data-multiselect");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
180 if (dataMultiSelectValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
181 this.dataMultiSelect = Boolean.parseBoolean(dataMultiSelectValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
182 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
183
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
184 String dataNoSelectValue =Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
185 "data-noselect");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
186 if (dataNoSelectValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
187 this. dataNoSelect = Boolean.parseBoolean(dataNoSelectValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
188 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
189
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
190 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
191
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
192 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
193 * @see de.intevation.gnv.state.State#getParent()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
194 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
195 public State getParent() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
196 return this.parent;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
197 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
198
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
199 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
200 * @see de.intevation.gnv.state.State#setParent(de.intevation.gnv.state.State)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
201 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
202 public void setParent(State state) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
203 this.parent = state;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
204 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
205
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
206 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
207 * @see de.intevation.gnv.state.State#putInputData(java.util.Collection)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
208 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
209 public void putInputData(Collection<InputData> inputData, String uuid)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
210 throws StateException {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
211 log.debug("StateBase.putInputData");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
212 if (inputData != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
213 Iterator<InputData> it = inputData.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
214 InputValidator iv = new InputValidator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
215 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
216 InputData tmpItem = it.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
217 InputValue inputValue = this.inputValues.get(tmpItem.getName());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
218 if (inputValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
219 if (this.inputData == null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
220 this.inputData = new HashMap<String, InputData>(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
221 inputData.size());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
222 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
223
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
224 boolean valid = iv.isInputValid(tmpItem.getValue(),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
225 inputValue.getType());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
226 if (valid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
227 if (tmpItem.getName().equals(MINVALUEFIELDNAME)){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
228 String minValue = tmpItem.getValue();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
229 String maxValue = this.getInputValue4ID(inputData, MAXVALUEFIELDNAME);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
230 valid = iv.isInputValid(maxValue,inputValue.getType());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
231 if (!valid){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
232 String errMsg = "Wrong input for " + tmpItem.getValue()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
233 + " is not an " + inputValue.getType()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
234 + " Value.";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
235 log.warn(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
236 throw new StateException(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
237 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
238
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
239 valid = iv.isInputValid(minValue,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
240 maxValue,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
241 inputValue.getType());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
242 if (!valid){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
243 String errMsg = "MaxValue-Input is less than MinValue-Input ";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
244 log.warn(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
245 throw new StateException(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
246 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
247 }else if (tmpItem.getName().equals(MAXVALUEFIELDNAME)){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
248 String minValue = this.getInputValue4ID(inputData, MINVALUEFIELDNAME);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
249 String maxValue = tmpItem.getValue();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
250 valid = iv.isInputValid(minValue,inputValue.getType());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
251 if (!valid){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
252 String errMsg = "Wrong input for " + tmpItem.getValue()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
253 + " is not an " + inputValue.getType()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
254 + " Value.";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
255 log.warn(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
256 throw new StateException(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
257 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
258
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
259 valid = iv.isInputValid(minValue,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
260 maxValue,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
261 inputValue.getType());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
262 if (!valid){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
263 String errMsg = "MaxValue-Input is less than MinValue-Input ";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
264 log.warn(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
265 throw new StateException(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
266 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
267 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
268 this.setSelection(tmpItem, uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
269 this.inputData.put(tmpItem.getName(), tmpItem);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
270 } else {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
271 String errMsg = "Wrong input for " + tmpItem.getValue()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
272 + " is not an " + inputValue.getType()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
273 + " Value.";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
274 log.warn(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
275 throw new StateException(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
276 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
277
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
278 } else {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
279 String errMsg = "No Inputvalue given for Inputdata "
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
280 + tmpItem.getName();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
281 log.warn(errMsg + "Value will be ignored");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
282
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
283 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
284 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
285 } else {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
286 log.warn("No Inputdata given");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
287 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
288 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
289
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
290 private String getInputValue4ID(Collection<InputData> inputData, String inputName){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
291 Iterator<InputData> it = inputData.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
292 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
293 InputData tmpItem = it.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
294 if (tmpItem.getName().equals(inputName)){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
295 return tmpItem.getValue();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
296 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
297 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
298 return null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
299 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
300
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
301 private void setSelection(InputData inputData, String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
302 log.debug("StateBase.setSelection");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
303
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
304 Object o = this.getDescribeData(inputData.getName(),uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
305 if (o != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
306 if (o instanceof Collection<?>) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
307 Collection<KeyValueDescibeData> values = (Collection<KeyValueDescibeData>) o;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
308
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
309 String value = inputData.getValue();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
310 String[] selectedValues = value.split(",");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
311 Set<String> selectedItems = new HashSet<String>(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
312 selectedValues.length);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
313 for (int i = 0; i < selectedValues.length; i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
314 selectedItems.add(selectedValues[i].trim());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
315 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
316 // Selektion umsetzen
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
317 Iterator<KeyValueDescibeData> it = values.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
318 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
319 KeyValueDescibeData data = it.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
320 String key = "" + data.getKey();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
321 boolean selected = selectedItems.contains(key);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
322 data.setSelected(selected);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
323 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
324 } else if (o instanceof MinMaxDescribeData) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
325 MinMaxDescribeData data = (MinMaxDescribeData) o;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
326 if (inputData.getName().equals(MINVALUEFIELDNAME)) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
327 data.setMinValue(inputData.getValue());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
328 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
329 if (inputData.getName().equals(MAXVALUEFIELDNAME)) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
330 data.setMaxValue(inputData.getValue());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
331 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
332 } else if (o instanceof SingleValueDescribeData) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
333 ((SingleValueDescribeData)o).setValue(inputData.getValue());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
334 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
335 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
336 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
337
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
338 private Object getDescribeData(String name, String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
339 log.debug("StateBase.getDescribeData");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
340 Collection<Object> descibeData = this.getDescibeData(uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
341 if (descibeData != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
342 Iterator<Object> it = descibeData.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
343 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
344 Object o = it.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
345 if (o instanceof NamedCollection<?>) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
346 if (name.equals(((NamedCollection<?>) o).getName())) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
347 return o;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
348 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
349 } else if (o instanceof MinMaxDescribeData) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
350 if (name.equals(((MinMaxDescribeData) o).getMinName())) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
351 return o;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
352 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
353 if (name.equals(((MinMaxDescribeData) o).getMaxName())) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
354 return o;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
355 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
356 }else if (o instanceof SingleValueDescribeData) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
357 if (name.equals(((SingleValueDescribeData)o).getName())){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
358 return o;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
359 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
360 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
361 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
362 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
363 return null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
364 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
365
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
366 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
367 * @see de.intevation.gnv.state.State#advance(java.lang.String,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
368 * de.intevation.artifacts.CallMeta)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
369 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
370 public void advance(String uuid, CallMeta callMeta)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
371 throws StateException {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
372 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
373
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
374 public void initialize(String uuid, CallMeta callMeta)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
375 throws StateException {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
376 log.debug("StateBase.initialize");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
377 try {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
378 String[] filterValues = this
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
379 .generateFilterValuesFromInputData();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
380 Collection<Result> result = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
381 try {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
382 if (this.queryID != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
383 QueryExecutor queryExecutor = QueryExecutorFactory
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
384 .getInstance().getQueryExecutor();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
385 result = queryExecutor.executeQuery(this.queryID,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
386 filterValues);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
387 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
388 this.purifyResult(result, uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
389 } catch (RuntimeException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
390 log.error(e, e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
391 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
392 } catch (QueryException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
393 log.error(e, e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
394 throw new StateException(e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
395 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
396 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
397
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
398 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
399 * @return
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
400 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
401 protected String[] generateFilterValuesFromInputData() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
402 List<String> list = new ArrayList<String>();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
403 Iterator<String> it = this.inputValueNames.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
404 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
405 String value = it.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
406 InputData data = this.inputData.get(value);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
407 if (data != null
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
408 && this.inputValues.containsKey(data.getName())) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
409 int size = this.inputValues.get(data.getName())
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
410 .usedInQueries();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
411 String type = this.inputValues.get(data.getName())
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
412 .getType();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
413 String requestValue = data.getValue();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
414 if (type.equalsIgnoreCase("string")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
415 requestValue = this
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
416 .prepareInputData4DBQuery(requestValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
417 } else if (type.equalsIgnoreCase("date")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
418 requestValue = this
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
419 .prepareInputData4DateDBQuery(requestValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
420 } else if (type.equalsIgnoreCase("coordinate")){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
421 requestValue = this
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
422 .prepareInputData4RegionDBQuery(requestValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
423 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
424 for (int j = 0; j < size; j++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
425 list.add(requestValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
426 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
427 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
428 }
428
88cd37c3b5e4 Adjusted sql queries and configuration for verticalcrosssection products. Some code refactoring and improved error handling.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 337
diff changeset
429 String[] filterValues = list.toArray(new String[list.size()]);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
430 return filterValues;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
431 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
432
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
433 protected String prepareInputData4RegionDBQuery(String value){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
434 return value;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
435 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
436
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
437 private String prepareInputData4DateDBQuery(String value) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
438 log.debug("StateBase.prepareInputData4DateDBQuery");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
439 if (value != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
440 String[] values = value.split(",");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
441 String newValue = "";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
442 for (int i = 0; i < values.length; i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
443 if (newValue.length() > 0) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
444 newValue = newValue + " , ";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
445 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
446 // TODO JUST HACK FIND A BETTER RESOLUTION
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
447 newValue = newValue + "to_date('" + values[i].trim()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
448 + "', 'YYYY.MM.DD HH24:MI:SS')";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
449 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
450 return newValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
451 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
452
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
453 return value;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
454 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
455
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
456 private String prepareInputData4DBQuery(String value) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
457 log.debug("StateBase.prepareInputData4DBQuery");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
458 if (value != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
459 String[] values = value.split(",");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
460 String newValue = "";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
461 for (int i = 0; i < values.length; i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
462 if (newValue.length() > 0) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
463 newValue = newValue + " , ";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
464 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
465 newValue = newValue + "'" + values[i].trim() + "'";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
466 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
467 return newValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
468 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
469
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
470 return value;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
471
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
472 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
473
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
474 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
475 * @param result
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
476 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
477 protected void purifyResult(Collection<Result> result, String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
478 log.debug("StateBase.purifyResult");
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
479 List<Object> describeData = this.getDescibeData(uuid);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
480 if (describeData == null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
481 describeData = new ArrayList<Object>();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
482 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
483 NamedCollection<KeyValueDescibeData> keyValueDescibeData = extractKVP(result, "KEY", "VALUE");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
484 describeData.add(keyValueDescibeData);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
485 this.setDescibeData(uuid, describeData);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
486 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
487
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
488 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
489 * @param result
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
490 * @return
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
491 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
492 protected NamedCollection<KeyValueDescibeData> extractKVP(Collection<Result> result,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
493 String keyid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
494 String valueid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
495 Iterator<Result> rit = result.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
496 int dataSize = (this.dataNoSelect ? result.size()+1 : result.size());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
497
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
498 NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
499 this.dataName, dataSize);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
500 keyValueDescibeData.setMultiSelect(this.dataMultiSelect);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
501
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
502 if (this.dataNoSelect){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
503 keyValueDescibeData.add(new DefaultKeyValueDescribeData(NODATASELECTIONKEY,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
504 "No Selection"));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
505 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
506 boolean initialized = false;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
507 int keyPos= 0;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
508 int valuePos = 1;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
509 String previousKey = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
510 while (rit.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
511 Result resultValue = rit.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
512 if (!initialized){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
513 keyPos = resultValue.getResultDescriptor().getColumnIndex(keyid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
514 valuePos = resultValue.getResultDescriptor().getColumnIndex(valueid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
515 if (valuePos < 0){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
516 valuePos = 1;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
517 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
518 initialized = true;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
519 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
520 String tmpKey = resultValue.getString(keyPos);
461
3ddc22aab764 Removed Encodingerrors from listed Files. All Files are now UTF-8 compliant.
Tim Englich <tim.englich@intevation.de>
parents: 456
diff changeset
521 // TODO: FIXME: We have to do that because the arcsde does not support a distinct Query on Layers.
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
522 if (previousKey == null || !tmpKey.equals(previousKey)){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
523 previousKey = tmpKey;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
524 keyValueDescibeData.add(new DefaultKeyValueDescribeData(tmpKey, resultValue.getString(valuePos)));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
525 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
526 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
527 return keyValueDescibeData;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
528 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
529
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
530 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
531 * @see de.intevation.gnv.state.State#describe(org.w3c.dom.Document,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
532 * org.w3c.dom.Node, de.intevation.artifacts.CallMeta,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
533 * java.lang.String)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
534 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
535 public void describe(Document document, Node rootNode, CallMeta callMeta,String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
536 log.debug("StateBase.describe");
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
537
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
538 List<Object> descibeData = this.getDescibeData(uuid);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
539 if (descibeData != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
540 Iterator<Object> it = descibeData.iterator();
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
541
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
542 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
543 document,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
544 ArtifactNamespaceContext.NAMESPACE_URI,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
545 ArtifactNamespaceContext.NAMESPACE_PREFIX
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
546 );
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
547 Node staticNode = creator.create("static");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
548 Node dynamic = creator.create("dynamic");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
549
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
550 rootNode.appendChild(staticNode);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
551 rootNode.appendChild(dynamic);
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
552
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
553 XMLUtils.ElementCreator xCreator = new XMLUtils.ElementCreator(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
554 document,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
555 XMLUtils.XFORM_URL,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
556 XMLUtils.XFORM_PREFIX
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
557 );
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
558
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
559 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
560 Object o = it.next();
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
561 if ((!it.hasNext() && dataName != null)) {
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
562 appendToDynamicNode(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
563 xCreator, document, dynamic, callMeta, o);
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
564 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
565 else {
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
566 appendToStaticNode(
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
567 xCreator, document, staticNode, callMeta, o);
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
568 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
569 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
570 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
571 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
572
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
573
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
574 protected void appendToStaticNode(
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
575 XMLUtils.ElementCreator creator,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
576 Document document,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
577 Node staticNode,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
578 CallMeta callMeta,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
579 Object o
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
580 ) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
581 if (o instanceof Collection<?>) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
582 String name = null;
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
583 boolean multiselect = false;
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
584 if (o instanceof NamedCollection<?>) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
585 NamedCollection<?> nc = ((NamedCollection<?>) o);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
586 name = nc.getName();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
587 multiselect = nc.isMultiSelect();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
588 } else {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
589 Object[] names = this.inputValueNames.toArray();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
590 name = names[names.length - 1].toString();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
591 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
592
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
593 Element selectNode = creator.create(multiselect?"select":"select1");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
594 creator.addAttr(selectNode, "ref", name);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
595
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
596 Element lableNode = creator.create("label");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
597 lableNode.setTextContent(RessourceFactory.getInstance()
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
598 .getRessource(callMeta.getLanguages(), name, name));
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
599 Element choiceNode = creator.create("choices");
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
600
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
601 Collection<KeyValueDescibeData> values = (Collection<KeyValueDescibeData>) o;
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
602 Iterator<KeyValueDescibeData> resultIt = values.iterator();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
603 while (resultIt.hasNext()) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
604 KeyValueDescibeData result = resultIt.next();
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
605
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
606 if (result.isSelected()) {
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
607 Element itemNode = creator.create("item");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
608
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
609 creator.addAttr(itemNode, "selected", "true");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
610
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
611 Element choiceLableNode = creator.create("label");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
612 choiceLableNode.setTextContent(result.getValue());
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
613 itemNode.appendChild(choiceLableNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
614
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
615 Element choiceValueNode = creator.create("value");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
616 choiceValueNode.setTextContent("" + result.getKey());
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
617 itemNode.appendChild(choiceValueNode);
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
618 choiceNode.appendChild(itemNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
619 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
620 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
621 selectNode.appendChild(lableNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
622 selectNode.appendChild(choiceNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
623
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
624 staticNode.appendChild(selectNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
625 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
626 else if (o instanceof MinMaxDescribeData) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
627 appendMinMaxDescribeData(
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
628 creator,
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
629 document,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
630 staticNode,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
631 callMeta,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
632 o);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
633 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
634 else if (o instanceof SingleValueDescribeData) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
635 appendSingleValueDescribeData(
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
636 creator,
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
637 document,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
638 staticNode,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
639 callMeta,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
640 o);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
641 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
642 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
643
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
644
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
645 protected void appendToDynamicNode(
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
646 XMLUtils.ElementCreator creator,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
647 Document document,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
648 Node dynamicNode,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
649 CallMeta callMeta,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
650 Object o
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
651 ) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
652 if (o instanceof Collection<?>) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
653 String name = null;
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
654 boolean multiselect = false;
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
655 if (o instanceof NamedCollection<?>) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
656 NamedCollection<?> nc = ((NamedCollection<?>) o);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
657 name = nc.getName();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
658 multiselect = nc.isMultiSelect();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
659 } else {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
660 Object[] names = this.inputValueNames.toArray();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
661 name = names[names.length - 1].toString();
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
662 }
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
663
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
664 Element selectNode = creator.create(multiselect?"select":"select1");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
665 creator.addAttr(selectNode, "ref", name);
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
666
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
667 Element lableNode = creator.create("label");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
668 lableNode.setTextContent(RessourceFactory.getInstance()
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
669 .getRessource(callMeta.getLanguages(), name, name));
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
670 Element choiceNode = creator.create("choices");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
671
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
672 Collection<KeyValueDescibeData> values = (Collection<KeyValueDescibeData>) o;
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
673 Iterator<KeyValueDescibeData> resultIt = values.iterator();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
674 while (resultIt.hasNext()) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
675 KeyValueDescibeData result = resultIt.next();
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
676 Element itemNode = creator.create("item");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
677
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
678 if (result.isSelected()) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
679 itemNode.setAttribute("selected", "true");
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
680 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
681
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
682 Element choiceLableNode = creator.create("label");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
683 choiceLableNode.setTextContent(result.getValue());
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
684 itemNode.appendChild(choiceLableNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
685
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
686 Element choicValueNode = creator.create("value");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
687 choicValueNode.setTextContent("" + result.getKey());
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
688 itemNode.appendChild(choicValueNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
689 choiceNode.appendChild(itemNode);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
690 }
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
691 selectNode.appendChild(lableNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
692 selectNode.appendChild(choiceNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
693
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
694 dynamicNode.appendChild(selectNode);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
695 }
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
696 else if (o instanceof MinMaxDescribeData) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
697 appendMinMaxDescribeData(
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
698 creator,
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
699 document,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
700 dynamicNode,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
701 callMeta,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
702 o);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
703 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
704 else if (o instanceof SingleValueDescribeData) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
705 appendSingleValueDescribeData(
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
706 creator,
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
707 document,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
708 dynamicNode,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
709 callMeta,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
710 o);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
711 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
712 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
713
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
714
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
715 protected void appendMinMaxDescribeData(
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
716 XMLUtils.ElementCreator creator,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
717 Document document,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
718 Node node,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
719 CallMeta callMeta,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
720 Object o
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
721 ) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
722 MinMaxDescribeData minMaxDescibeData = (MinMaxDescribeData) o;
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
723 Object min = minMaxDescibeData.getMinValue();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
724 Object max = minMaxDescibeData.getMaxValue();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
725 if (min instanceof GregorianCalendar) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
726 Date d = ((GregorianCalendar) min).getTime();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
727 min = DateUtils.getPatternedDateAmer(d);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
728 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
729
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
730 if (max instanceof GregorianCalendar) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
731 Date d = ((GregorianCalendar) max).getTime();
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
732 max = DateUtils.getPatternedDateAmer(d);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
733 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
734
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
735 Element groupNode = creator.create("group");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
736 creator.addAttr(groupNode, "ref", minMaxDescibeData.getName());
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
737 Element groupNodeLableNode = creator.create("label");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
738 groupNodeLableNode.setTextContent(RessourceFactory
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
739 .getInstance().getRessource(
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
740 callMeta.getLanguages(),
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
741 minMaxDescibeData.getName(),
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
742 minMaxDescibeData.getName()));
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
743 groupNode.appendChild(groupNodeLableNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
744
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
745 Element inputMinNode = creator.create("input");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
746 creator.addAttr(inputMinNode, "ref", MINVALUEFIELDNAME);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
747 Element inputMinLableNode = creator.create("label");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
748 inputMinLableNode.setTextContent(RessourceFactory
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
749 .getInstance().getRessource(
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
750 callMeta.getLanguages(), MINVALUEFIELDNAME,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
751 MINVALUEFIELDNAME));
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
752 inputMinNode.appendChild(inputMinLableNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
753
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
754 Element inputMinValueNode = creator.create("value");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
755 inputMinValueNode.setTextContent(min.toString());
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
756 inputMinNode.appendChild(inputMinValueNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
757
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
758 Element inputMaxNode = creator.create("input");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
759 creator.addAttr(inputMaxNode, "ref", MAXVALUEFIELDNAME);
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
760 Element inputMaxLableNode = creator.create("label");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
761 inputMaxLableNode.setTextContent(RessourceFactory
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
762 .getInstance().getRessource(
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
763 callMeta.getLanguages(), MAXVALUEFIELDNAME,
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
764 MAXVALUEFIELDNAME));
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
765 inputMaxNode.appendChild(inputMaxLableNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
766
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
767 Element inputMaxValueNode = creator.create("value");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
768 inputMaxValueNode.setTextContent(max.toString());
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
769 inputMaxNode.appendChild(inputMaxValueNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
770
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
771 groupNode.appendChild(inputMinNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
772 groupNode.appendChild(inputMaxNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
773
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
774 node.appendChild(groupNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
775 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
776
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
777
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
778
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
779 protected void appendSingleValueDescribeData(
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
780 XMLUtils.ElementCreator creator,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
781 Document document,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
782 Node node,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
783 CallMeta callMeta,
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
784 Object o
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
785 ) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
786 SingleValueDescribeData svdb = (SingleValueDescribeData) o;
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
787
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
788 Element groupNode = creator.create("group");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
789 creator.addAttr(groupNode, "ref", svdb.getName());
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
790
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
791 Element groupNodeLableNode = creator.create("label");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
792 groupNodeLableNode.setTextContent(RessourceFactory
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
793 .getInstance().getRessource(
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
794 callMeta.getLanguages(),
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
795 svdb.getName(),
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
796 svdb.getName()));
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
797 groupNode.appendChild(groupNodeLableNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
798
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
799 Element inputNode = creator.create("input");
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
800 creator.addAttr(inputNode, "ref", svdb.getName());
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
801
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
802 Element inputLableNode = creator.create("label");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
803 inputLableNode.setTextContent("");
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
804 inputNode.appendChild(inputLableNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
805
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
806 Element inputValueNode = creator.create("value");
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
807 inputValueNode.setTextContent(svdb.getValue());
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
808 inputNode.appendChild(inputValueNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
809
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
810 groupNode.appendChild(inputNode);
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
811
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
812 node.appendChild(groupNode);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
813 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
814
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
815 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
816 * @see de.intevation.gnv.state.State#getDescibeData()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
817 */
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
818 protected List<Object> getDescibeData(String uuid) {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
819 if (CacheFactory.getInstance().isInitialized()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
820 String key = uuid + DESCRIBEDATAKEY;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
821 log.debug("Hash for Queryelements: " + key);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
822 net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
823 if (value != null) {
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
824 return (List<Object>) (value.getObjectValue());
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
825 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
826 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
827 return null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
828 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
829
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
830 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
831 * @see de.intevation.gnv.state.State#getDescibeData()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
832 */
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
833 protected void setDescibeData(String uuid, List<Object> describeData) {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
834
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
835 if (CacheFactory.getInstance().isInitialized()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
836 String key = uuid + DESCRIBEDATAKEY;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
837 log.debug("Hash for Queryelements: " + key);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
838 CacheFactory.getInstance().getCache().put(new net.sf.ehcache.Element(key, describeData));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
839 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
840 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
841
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
842 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
843 * @see de.intevation.gnv.state.State#getInputData()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
844 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
845 public Collection<InputData> getInputData() throws StateException {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
846 return this.inputData != null ? this.inputData.values() : null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
847 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
848 }
464
70df44021a9f Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
849 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org