annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java @ 652:078ba6799bd2

Cleanup imports gnv-artifacts/trunk@743 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 06 Mar 2010 08:25:14 +0000
parents 154d158238d3
children dde7f51dbe1e
rev   line source
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.state;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2
623
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
3 import de.intevation.artifactdatabase.Config;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
4 import de.intevation.artifactdatabase.XMLUtils;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
5
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
6 import de.intevation.artifacts.ArtifactNamespaceContext;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
7 import de.intevation.artifacts.CallContext;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
8 import de.intevation.artifacts.CallMeta;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
9
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
10 import de.intevation.gnv.artifacts.cache.CacheFactory;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
11
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
12 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
13
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
14 import de.intevation.gnv.geobackend.base.Result;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
15
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
16 import de.intevation.gnv.geobackend.base.query.QueryExecutor;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
17 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
18
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
19 import de.intevation.gnv.geobackend.base.query.exception.QueryException;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
20
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
21 import de.intevation.gnv.geobackend.util.DateUtils;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
22
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
23 import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
24 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
25 import de.intevation.gnv.state.describedata.MinMaxDescribeData;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
26 import de.intevation.gnv.state.describedata.NamedArrayList;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
27 import de.intevation.gnv.state.describedata.NamedCollection;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
28 import de.intevation.gnv.state.describedata.SingleValueDescribeData;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
29
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
30 import de.intevation.gnv.state.exception.StateException;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
31
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
32 import de.intevation.gnv.utils.InputValidator;
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
33
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 import java.util.ArrayList;
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
35 import java.util.Arrays;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 import java.util.Collection;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 import java.util.Date;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 import java.util.GregorianCalendar;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39 import java.util.HashMap;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 import java.util.Iterator;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 import java.util.List;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 import java.util.Map;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
44 import javax.xml.xpath.XPathConstants;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
45
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
46 import net.sf.ehcache.Cache;
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
47
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 import org.apache.log4j.Logger;
623
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 615
diff changeset
49
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 import org.w3c.dom.Document;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 import org.w3c.dom.Element;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 import org.w3c.dom.Node;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 import org.w3c.dom.NodeList;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 /**
481
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 473
diff changeset
56 * @author Tim Englich (tim.englich@intevation.de)
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 473
diff changeset
57 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 473
diff changeset
58 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60 public abstract class StateBase implements State {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 * The UID of this Class
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 private static final long serialVersionUID = 2411169179001645426L;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66
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 * the logger, used to log exceptions and additonaly information
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 */
630
a72ecacccc91 Changed cache initialization so that we can use GNV without using a cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
70 private static Logger log = Logger.getLogger(StateBase.class);
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
71
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
72 protected final static String MINVALUEFIELDNAME = "minvalue";
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
73 protected final static String MAXVALUEFIELDNAME = "maxvalue";
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
74
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 private final static String NODATASELECTIONKEY = "n/n";
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
76
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
77 public final static String DESCRIBEDATAKEY = "_DESCRIBEDATA";
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
79 public final static String XPATH_STATIC_UI = "art:static";
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
80 public final static String XPATH_DYNAMIC_UI = "art:dynamic";
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
81
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
82 /** input value names which should not be rendered from State itself */
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
83 public final static String[] BLACKLIST = {"sourceid", "fisname"};
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
84
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 private String id = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
87 protected String hash;
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
88
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 private String description = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 protected String dataName = null;
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
92
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
93 protected String preSettingsName = null;
335
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 protected boolean dataMultiSelect = false;
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
96
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97 protected boolean dataNoSelect = false;
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 protected String queryID = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
100
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 protected Collection<String> inputValueNames = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
103 protected Map<String, InputValue> inputValues = null;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
105 protected State parent = null;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 protected Map<String, InputData> inputData = null;
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
108
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
109 protected Map<String, InputData> preSettings = null;
335
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 * Constructor
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
114 public StateBase() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115 super();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
116 }
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 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
119 * @see de.intevation.gnv.state.State#getID()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
120 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
121 public String getID() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122 return this.id;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
125 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
126 * @see de.intevation.gnv.state.State#getDescription()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
128 public String getDescription() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
129 return this.description;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
130 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
131
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
132
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
133
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
134 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
135 * @see de.intevation.gnv.state.State#getRequiredInputValues()
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 public Collection<InputValue> getRequiredInputValues() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
138 return this.inputValues.values();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
139 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
140
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
141
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
142 public void reset(String uuid) {
614
e80e37b78302 Repaired broken step-back-history.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 612
diff changeset
143 inputData.remove(dataName);
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
144 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
145
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
146
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
147 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
148 * @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
149 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
150 public void setup(Node configuration) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
151 this.id = ((Element)configuration).getAttribute("id");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
152 this.description = ((Element)configuration).getAttribute("description");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
153
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
154 log.info("State-ID = " + this.id);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
155
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156 NodeList inputValuesNodes = Config.getNodeSetXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157 "inputvalues/inputvalue");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
158 this.inputValues = new HashMap<String, InputValue>(inputValuesNodes
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
159 .getLength());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160 this.inputValueNames = new ArrayList<String>(inputValuesNodes
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
161 .getLength());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
162 for (int i = 0; i < inputValuesNodes.getLength(); i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
163 Element inputValueNode = (Element)inputValuesNodes.item(i);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
164 String usedinQueryValue = inputValueNode.getAttribute("usedinquery");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
165 int usedinQuery = 1;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
166 if (usedinQueryValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
167 try {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
168 usedinQuery = Integer.parseInt(usedinQueryValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
169 } catch (NumberFormatException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
170 log
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
171 .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
172 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
173 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
174 InputValue inputValue = new DefaultInputValue(inputValueNode.getAttribute("name"),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
175 inputValueNode.getAttribute("type"),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
176 Boolean.parseBoolean(inputValueNode.
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
177 getAttribute("multiselect")), usedinQuery);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
178 this.inputValues.put(inputValue.getName(), inputValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
179 this.inputValueNames.add(inputValue.getName());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
180 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
181
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
182 this.queryID = Config.getStringXPath(configuration, "queryID");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
183 log.info("QueryID ==> " + this.queryID);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
184
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
185 this.dataName = Config.getStringXPath(configuration, "dataname");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
186
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
187 String dataMultiSelectValue = Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
188 "data-multiselect");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
189 if (dataMultiSelectValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
190 this.dataMultiSelect = Boolean.parseBoolean(dataMultiSelectValue);
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 String dataNoSelectValue =Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
194 "data-noselect");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
195 if (dataNoSelectValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
196 this. dataNoSelect = Boolean.parseBoolean(dataNoSelectValue);
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
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
199 this.preSettingsName = Config.getStringXPath(configuration, "presettings-name");
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
200
335
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
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
203 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
204 * @see de.intevation.gnv.state.State#getParent()
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 public State getParent() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
207 return this.parent;
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
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
210 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
211 * @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
212 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
213 public void setParent(State state) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
214 this.parent = state;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
215 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
216
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
217
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
218 public void feed(Collection<InputData> inputData, String uuid)
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
219 throws StateException
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
220 {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
221 if (inputData != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
222 Iterator<InputData> it = inputData.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
223 InputValidator iv = new InputValidator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
224 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
225 InputData tmpItem = it.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
226 InputValue inputValue = this.inputValues.get(tmpItem.getName());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
227 if (inputValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
228 if (this.inputData == null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
229 this.inputData = new HashMap<String, InputData>(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
230 inputData.size());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
231 }
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
232
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
233 boolean valid = iv.isInputValid(tmpItem.getValue(),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
234 inputValue.getType());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
235 if (valid) {
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
236 String[] desc = getDescriptionForInputData(tmpItem, uuid);
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
237 tmpItem.setDescription(desc);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
238 this.inputData.put(tmpItem.getName(), tmpItem);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
239 } else {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
240 String errMsg = "Wrong input for " + tmpItem.getValue()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
241 + " is not an " + inputValue.getType()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
242 + " Value.";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
243 log.warn(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
244 throw new StateException(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
245 }
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 {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
248 String errMsg = "No Inputvalue given for Inputdata "
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
249 + tmpItem.getName();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
250 log.warn(errMsg + "Value will be ignored");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
251
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
252 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
253 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
254 } else {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
255 log.warn("No Inputdata given");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
256 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
257 }
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
258
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
259
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
260 private String[] getDescriptionForInputData(InputData data, String uuid) {
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
261 // there is only one element in the list, so take the first
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
262 Object obj = getDescibeData(uuid).get(0);
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
263 List descs = new ArrayList();
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
264
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
265 if (obj instanceof NamedArrayList) {
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
266 NamedArrayList list = (NamedArrayList) obj;
634
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
267 List selected = Arrays.asList(data.splitValue());
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
268 int size = list.size();
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
269
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
270 for (int i = 0; i < size; i++) {
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
271 KeyValueDescibeData kv = (KeyValueDescibeData) list.get(i);
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
272
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
273 // values are concatinated in InputData, so one InputData object can
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
274 // contain many input
634
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
275 String key = kv.getKey();
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
276 int idx = selected.indexOf(key);
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
277 if (idx >= 0) {
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
278 descs.add(kv.getValue());
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
279
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
280 // XXX Workarround: I just wanted to remove the element at
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
281 // 'idx' from selected, but for any reason this is not
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
282 // possible (throws an exception) (iw)
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
283 List tmp = new ArrayList();
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
284 for (int j = 0; j < selected.size(); j++) {
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
285 if (j != idx)
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
286 tmp.add(selected.get(j));
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
287 }
634
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
288
58c32df1a44d Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 630
diff changeset
289 selected = tmp;
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
290 }
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
291 }
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
292 }
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
293
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
294 return (String[]) descs.toArray(new String[descs.size()]);
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
295 }
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
296
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
297
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
298 /**
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
299 * @see de.intevation.gnv.state.State#putInputData(java.util.Collection)
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
300 */
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
301 public void putInputData(Collection<InputData> inputData, String uuid)
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
302 throws StateException {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
303 if (inputData != null) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
304 Iterator<InputData> it = inputData.iterator();
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
305 InputValidator iv = new InputValidator();
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
306 while (it.hasNext()) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
307 InputData tmpItem = it.next();
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
308 InputValue inputValue = this.inputValues.get(tmpItem.getName());
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
309 if (inputValue != null) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
310 if (this.inputData == null) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
311 this.inputData = new HashMap<String, InputData>(
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
312 inputData.size());
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
313 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
314
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
315 boolean valid = iv.isInputValid(tmpItem.getValue(),
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
316 inputValue.getType());
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
317 if (valid) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
318 if (tmpItem.getName().equals(MINVALUEFIELDNAME)){
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
319 String minValue = tmpItem.getValue();
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
320 String maxValue = this.getInputValue4ID(inputData, MAXVALUEFIELDNAME);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
321 valid = iv.isInputValid(maxValue,inputValue.getType());
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
322 if (!valid){
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
323 String errMsg = "Wrong input for " + tmpItem.getValue()
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
324 + " is not an " + inputValue.getType()
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
325 + " Value.";
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
326 log.warn(errMsg);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
327 throw new StateException(errMsg);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
328 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
329
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
330 valid = iv.isInputValid(minValue,
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
331 maxValue,
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
332 inputValue.getType());
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
333 if (!valid){
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
334 String errMsg = "MaxValue-Input is less than MinValue-Input ";
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
335 log.warn(errMsg);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
336 throw new StateException(errMsg);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
337 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
338 }else if (tmpItem.getName().equals(MAXVALUEFIELDNAME)){
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
339 String minValue = this.getInputValue4ID(inputData, MINVALUEFIELDNAME);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
340 String maxValue = tmpItem.getValue();
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
341 valid = iv.isInputValid(minValue,inputValue.getType());
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
342 if (!valid){
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
343 String errMsg = "Wrong input for " + tmpItem.getValue()
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
344 + " is not an " + inputValue.getType()
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
345 + " Value.";
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
346 log.warn(errMsg);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
347 throw new StateException(errMsg);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
348 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
349
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
350 valid = iv.isInputValid(minValue,
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
351 maxValue,
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
352 inputValue.getType());
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
353 if (!valid){
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
354 String errMsg = "MaxValue-Input is less than MinValue-Input ";
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
355 log.warn(errMsg);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
356 throw new StateException(errMsg);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
357 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
358 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
359 this.inputData.put(tmpItem.getName(), tmpItem);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
360 } else {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
361 String errMsg = "Wrong input for " + tmpItem.getValue()
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
362 + " is not an " + inputValue.getType()
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
363 + " Value.";
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
364 log.warn(errMsg);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
365 throw new StateException(errMsg);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
366 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
367
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
368 } else {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
369 String errMsg = "No Inputvalue given for Inputdata "
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
370 + tmpItem.getName();
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
371 log.warn(errMsg + "Value will be ignored");
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
372
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
373 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
374 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
375 } else {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
376 log.warn("No Inputdata given");
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
377 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
378
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
379 setHash(uuid);
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
380 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
381
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
382
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
383 /**
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
384 *
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
385 * @see de.intevation.gnv.state.State#setPreSettings(java.util.Map)
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
386 */
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
387 public void setPreSettings(Map<String, InputData> preSettings) {
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
388 this.preSettings = preSettings;
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
389 }
612
e86d37008fd1 Added new Transition and State for using the PreSettingsValue for the decision if a Transition could be used
Tim Englich <tim.englich@intevation.de>
parents: 610
diff changeset
390
e86d37008fd1 Added new Transition and State for using the PreSettingsValue for the decision if a Transition could be used
Tim Englich <tim.englich@intevation.de>
parents: 610
diff changeset
391
e86d37008fd1 Added new Transition and State for using the PreSettingsValue for the decision if a Transition could be used
Tim Englich <tim.englich@intevation.de>
parents: 610
diff changeset
392
e86d37008fd1 Added new Transition and State for using the PreSettingsValue for the decision if a Transition could be used
Tim Englich <tim.englich@intevation.de>
parents: 610
diff changeset
393 public Map<String, InputData> getPreSettings() {
e86d37008fd1 Added new Transition and State for using the PreSettingsValue for the decision if a Transition could be used
Tim Englich <tim.englich@intevation.de>
parents: 610
diff changeset
394 return this.preSettings;
e86d37008fd1 Added new Transition and State for using the PreSettingsValue for the decision if a Transition could be used
Tim Englich <tim.englich@intevation.de>
parents: 610
diff changeset
395 }
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
396
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 609
diff changeset
397 protected String getInputValue4ID(Collection<InputData> inputData, String inputName){
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
398 Iterator<InputData> it = inputData.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
399 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
400 InputData tmpItem = it.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
401 if (tmpItem.getName().equals(inputName)){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
402 return tmpItem.getValue();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
403 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
404 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
405 return null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
406 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
407
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
408
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
409 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
410 * @see de.intevation.gnv.state.State#advance(java.lang.String,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
411 * de.intevation.artifacts.CallMeta)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
412 */
493
cef17cc90fd0 Changed some method signatures of the State interface. Use CallContext objects instead of CallMeta objects which are a subset of CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
413 public void advance(String uuid, CallContext context)
cef17cc90fd0 Changed some method signatures of the State interface. Use CallContext objects instead of CallMeta objects which are a subset of CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
414 throws StateException
cef17cc90fd0 Changed some method signatures of the State interface. Use CallContext objects instead of CallMeta objects which are a subset of CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
415 {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
416 }
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
417
493
cef17cc90fd0 Changed some method signatures of the State interface. Use CallContext objects instead of CallMeta objects which are a subset of CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
418 public void initialize(String uuid, CallContext context)
cef17cc90fd0 Changed some method signatures of the State interface. Use CallContext objects instead of CallMeta objects which are a subset of CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
419 throws StateException
cef17cc90fd0 Changed some method signatures of the State interface. Use CallContext objects instead of CallMeta objects which are a subset of CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
420 {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
421 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
422
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 * @return
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
425 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
426 protected String[] generateFilterValuesFromInputData() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
427 List<String> list = new ArrayList<String>();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
428 Iterator<String> it = this.inputValueNames.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
429 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
430 String value = it.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
431 InputData data = this.inputData.get(value);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
432 if (data != null
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
433 && this.inputValues.containsKey(data.getName())) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
434 int size = this.inputValues.get(data.getName())
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
435 .usedInQueries();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
436 String type = this.inputValues.get(data.getName())
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
437 .getType();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
438 String requestValue = data.getValue();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
439 if (type.equalsIgnoreCase("string")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
440 requestValue = this
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
441 .prepareInputData4DBQuery(requestValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
442 } else if (type.equalsIgnoreCase("date")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
443 requestValue = this
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
444 .prepareInputData4DateDBQuery(requestValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
445 } else if (type.equalsIgnoreCase("coordinate")){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
446 requestValue = this
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
447 .prepareInputData4RegionDBQuery(requestValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
448 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
449 for (int j = 0; j < size; j++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
450 list.add(requestValue);
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 }
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
454 String[] filterValues = list.toArray(new String[list.size()]);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
455 return filterValues;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
456 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
457
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
458 protected String prepareInputData4RegionDBQuery(String value){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
459 return value;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
460 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
461
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
462 private String prepareInputData4DateDBQuery(String value) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
463 if (value != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
464 String[] values = value.split(",");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
465 String newValue = "";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
466 for (int i = 0; i < values.length; i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
467 if (newValue.length() > 0) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
468 newValue = newValue + " , ";
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 // TODO JUST HACK FIND A BETTER RESOLUTION
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
471 newValue = newValue + "to_date('" + values[i].trim()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
472 + "', 'YYYY.MM.DD HH24:MI:SS')";
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 return newValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
475 }
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 return value;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
478 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
479
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
480 private String prepareInputData4DBQuery(String value) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
481 if (value != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
482 String[] values = value.split(",");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
483 String newValue = "";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
484 for (int i = 0; i < values.length; i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
485 if (newValue.length() > 0) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
486 newValue = newValue + " , ";
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 newValue = newValue + "'" + values[i].trim() + "'";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
489 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
490 return newValue;
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
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
493 return value;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
494
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
495 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
496
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 * @param result
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
499 */
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
500 protected List<Object> purifyResult(Collection<Result> result, String uuid) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
501 List<Object> describeData = new ArrayList<Object>();
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
502
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
503 NamedCollection<KeyValueDescibeData> keyValueDescibeData =
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
504 extractKVP(result, "KEY", "VALUE");
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
505
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
506 describeData.add(keyValueDescibeData);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
507
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
508 return describeData;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
509 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
510
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
511 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
512 * @param result
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
513 * @return
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
514 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
515 protected NamedCollection<KeyValueDescibeData> extractKVP(Collection<Result> result,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
516 String keyid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
517 String valueid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
518 Iterator<Result> rit = result.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
519 int dataSize = (this.dataNoSelect ? result.size()+1 : result.size());
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
520
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
521 NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
522 this.dataName, dataSize);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
523 keyValueDescibeData.setMultiSelect(this.dataMultiSelect);
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
524
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
525 if (this.dataNoSelect){
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
526 keyValueDescibeData.add(new DefaultKeyValueDescribeData(
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
527 NODATASELECTIONKEY,
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
528 "No Selection",
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
529 getID()
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
530 ));
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
531 }
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
532
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
533 boolean initialized = false;
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
534 int keyPos = 0;
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
535 int valuePos = 1;
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
536 String previousKey = null;
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
537 InputData preSettingsData =
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
538 (this.preSettings != null && this.preSettingsName != null)
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
539 ? this.preSettings.get(this.preSettingsName)
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
540 : null;
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
541 boolean filterWithPresettings = preSettingsData != null;
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
542
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
543 List<String> preSettingValues = null;
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
544 if(filterWithPresettings){
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
545 preSettingValues = Arrays.asList(preSettingsData.splitValue());
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
546 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
547 while (rit.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
548 Result resultValue = rit.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
549 if (!initialized){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
550 keyPos = resultValue.getResultDescriptor().getColumnIndex(keyid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
551 valuePos = resultValue.getResultDescriptor().getColumnIndex(valueid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
552 if (valuePos < 0){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
553 valuePos = 1;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
554 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
555 initialized = true;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
556 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
557 String tmpKey = resultValue.getString(keyPos);
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
558
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
559 // TODO: FIXME: We have to do that because the arcsde does not
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
560 // support a distinct Query on Layers.
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
561 if (previousKey == null || !tmpKey.equals(previousKey)){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
562 previousKey = tmpKey;
598
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
563 if (!filterWithPresettings || preSettingValues.contains(tmpKey)){
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
564 keyValueDescibeData.add(
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
565 new DefaultKeyValueDescribeData(
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
566 tmpKey,
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
567 resultValue.getString(valuePos),
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
568 getID())
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
569 );
9681ac6b6527 Added the possibility to use the data which are send using the MapServer-Interface during the Workflow of the GNV-Artifacts.
Tim Englich <tim.englich@intevation.de>
parents: 493
diff changeset
570 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
571 }
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 return keyValueDescibeData;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
574 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
575
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
576
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
577 public static boolean inBlackList(String key) {
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
578 int length = BLACKLIST.length;
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
579 for (int i = 0; i < length; i++) {
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
580 if (BLACKLIST[i].equals(key)) {
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
581 return true;
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
582 }
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
583 }
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
584
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
585 return false;
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
586 }
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
587
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
588 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
589 * @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
590 * org.w3c.dom.Node, de.intevation.artifacts.CallMeta,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
591 * java.lang.String)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
592 */
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
593 public void describe(
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
594 Document document,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
595 Node rootNode,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
596 CallContext context,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
597 String uuid)
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
598 {
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
599 XMLUtils.ElementCreator xCreator = new XMLUtils.ElementCreator(
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
600 document,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
601 XMLUtils.XFORM_URL,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
602 XMLUtils.XFORM_PREFIX
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
603 );
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
604
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
605 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
606 document,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
607 ArtifactNamespaceContext.NAMESPACE_URI,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
608 ArtifactNamespaceContext.NAMESPACE_PREFIX
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
609 );
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
610
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
611 // append dynamic node
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
612 Node dynamic = (Node) XMLUtils.xpath(
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
613 rootNode,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
614 XPATH_DYNAMIC_UI,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
615 XPathConstants.NODE,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
616 ArtifactNamespaceContext.INSTANCE
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
617 );
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
618
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
619 describeDynamic(
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
620 creator, xCreator, document, dynamic, context, uuid);
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
621
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
622 // append static nodes
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
623 Node staticNode = (Node) XMLUtils.xpath(
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
624 rootNode,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
625 XPATH_STATIC_UI,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
626 XPathConstants.NODE,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
627 ArtifactNamespaceContext.INSTANCE
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
628 );
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
629
636
22cc12b1622c Take parent states only to describe static user interface part - not the current state itself.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 634
diff changeset
630 State parent = getParent();
22cc12b1622c Take parent states only to describe static user interface part - not the current state itself.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 634
diff changeset
631 if (parent != null && parent instanceof StateBase) {
22cc12b1622c Take parent states only to describe static user interface part - not the current state itself.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 634
diff changeset
632 ((StateBase) parent).describeStatic(
22cc12b1622c Take parent states only to describe static user interface part - not the current state itself.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 634
diff changeset
633 creator,xCreator, document, staticNode, context,uuid);
22cc12b1622c Take parent states only to describe static user interface part - not the current state itself.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 634
diff changeset
634 }
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
635 }
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
636
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
637
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
638 protected void describeDynamic(
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
639 XMLUtils.ElementCreator artCreator,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
640 XMLUtils.ElementCreator creator,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
641 Document document,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
642 Node dynamic,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
643 CallContext context,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
644 String uuid)
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
645 {
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
646 CallMeta callMeta = context.getMeta();
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
647
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
648 if (dataName == null)
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
649 return;
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
650
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
651 List<Object> descibeData = getDescibeData(uuid);
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
652 if (descibeData != null) {
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
653 Iterator<Object> it = descibeData.iterator();
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
654
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
655 while (it.hasNext()) {
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
656 Object o = it.next();
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
657 if ((!it.hasNext() && dataName != null)) {
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
658 appendToDynamicNode(
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
659 artCreator, creator, document, dynamic, callMeta, o);
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
660 }
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
661 }
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
662 }
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
663 }
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
664
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
665
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
666 protected void describeStatic(
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
667 XMLUtils.ElementCreator artCreator,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
668 XMLUtils.ElementCreator creator,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
669 Document document,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
670 Node staticNode,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
671 CallContext context,
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
672 String uuid)
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
673 {
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
674 State parent = getParent();
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
675 if (parent != null && parent instanceof StateBase) {
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
676 ((StateBase) parent).describeStatic(
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
677 artCreator, creator, document, staticNode, context, uuid);
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
678 }
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
679
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
680 CallMeta callMeta = context.getMeta();
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
681 appendToStaticNode(artCreator, creator, document, staticNode, callMeta);
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
682 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
683
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
684
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
685 protected void appendToStaticNode(
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
686 XMLUtils.ElementCreator artCreator,
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
687 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
688 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
689 Node staticNode,
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
690 CallMeta callMeta
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 ) {
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
692 InputData data = inputData.get(dataName);
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
693
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
694 if (data == null) {
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
695 return;
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 }
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
697
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
698 Element selectNode = creator.create("select1");
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
699 creator.addAttr(selectNode, "ref", dataName);
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
700
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
701 Element lableNode = creator.create("label");
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
702 lableNode.setTextContent(RessourceFactory.getInstance()
608
74dfb9346574 Added descriptions to the selected input data and use them for rendering the GUI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 607
diff changeset
703 .getRessource(callMeta.getLanguages(), dataName, dataName));
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
704 Element choiceNode = creator.create("choices");
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
705
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
706 artCreator.addAttr(
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
707 selectNode, "state", getID(), true
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
708 );
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
709
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
710 String[] descriptions = data.getDescription();
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
711 int size = descriptions.length;
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
712
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
713 for (int i = 0; i < size; i++) {
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
714 Element itemNode = creator.create("item");
637
154d158238d3 Display the selected value if there is no description avaible. WKT-strings will be displayed again (issue182).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 636
diff changeset
715 String value = data.getValue();
154d158238d3 Display the selected value if there is no description avaible. WKT-strings will be displayed again (issue182).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 636
diff changeset
716 String desc = descriptions[i];
154d158238d3 Display the selected value if there is no description avaible. WKT-strings will be displayed again (issue182).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 636
diff changeset
717 desc = desc == null ? value : desc;
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
718
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
719 creator.addAttr(itemNode, "selected", "true");
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
720
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
721 Element choiceLableNode = creator.create("label");
637
154d158238d3 Display the selected value if there is no description avaible. WKT-strings will be displayed again (issue182).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 636
diff changeset
722 choiceLableNode.setTextContent(desc);
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
723 itemNode.appendChild(choiceLableNode);
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
724
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
725 Element choiceValueNode = creator.create("value");
637
154d158238d3 Display the selected value if there is no description avaible. WKT-strings will be displayed again (issue182).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 636
diff changeset
726 choiceValueNode.setTextContent(value);
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
727 itemNode.appendChild(choiceValueNode);
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
728 choiceNode.appendChild(itemNode);
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
729 }
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 614
diff changeset
730
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
731 selectNode.appendChild(lableNode);
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
732 selectNode.appendChild(choiceNode);
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
733
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
734 staticNode.appendChild(selectNode);
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
735 }
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
736
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
737
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 protected void appendToDynamicNode(
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
739 XMLUtils.ElementCreator artCreator,
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
740 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
741 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
742 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
743 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
744 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
745 ) {
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
746 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
747 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
748 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
749 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
750 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
751 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
752 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
753 } 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
754 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
755 name = names[names.length - 1].toString();
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
756 }
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
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 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
759 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
760
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
761 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
762 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
763 .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
764 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
765
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 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
767 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
768 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
769 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
770 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
771
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 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
773 itemNode.setAttribute("selected", "true");
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
774 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
775
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
776 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
777 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
778 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
779
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 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
781 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
782 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
783 choiceNode.appendChild(itemNode);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
784 }
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 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
786 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
787
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
788 dynamicNode.appendChild(selectNode);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
789 }
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
790 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
791 appendMinMaxDescribeData(
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
792 artCreator,
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
793 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
794 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
795 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
796 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
797 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
798 }
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
799 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
800 appendSingleValueDescribeData(
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
801 artCreator,
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 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
803 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
804 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
805 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
806 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
807 }
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 }
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
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 protected void appendMinMaxDescribeData(
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
812 XMLUtils.ElementCreator artCreator,
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
813 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
814 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
815 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
816 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
817 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
818 ) {
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
819 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
820 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
821 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
822 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
823 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
824 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
825 }
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
826
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
827 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
828 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
829 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
830 }
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
831
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
832 Element groupNode = creator.create("group");
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
833 artCreator.addAttr(groupNode, "state", minMaxDescibeData.getState(), true);
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
834
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
835 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
836 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
837 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
838 .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
839 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
840 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
841 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
842 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
843
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
844 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
845 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
846 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
847 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
848 .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
849 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
850 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
851 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
852
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
853 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
854 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
855 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
856
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
857 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
858 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
859 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
860 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
861 .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
862 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
863 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
864 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
865
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
866 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
867 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
868 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
869
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
870 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
871 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
872
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
873 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
874 }
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
875
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
876
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
877 protected void appendSingleValueDescribeData(
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
878 XMLUtils.ElementCreator artCreator,
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
879 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
880 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
881 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
882 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
883 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
884 ) {
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
885 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
886
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
887 Element groupNode = creator.create("group");
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
888 artCreator.addAttr(groupNode, "state", svdb.getState(), true);
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
889 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
890
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
891 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
892 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
893 .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
894 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
895 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
896 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
897 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
898
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
899 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
900 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
901
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
902 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
903 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
904 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
905
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
906 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
907 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
908 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
909
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
910 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
911
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
912 node.appendChild(groupNode);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
913 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
914
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
915
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
916 protected void setHash(String uuid) {
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
917 this.hash = uuid + id + inputData.hashCode();
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
918 }
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
919
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
920
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
921 protected String getHash() {
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
922 return this.hash;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
923 }
605
e8ebdbc7f1e3 First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 598
diff changeset
924
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
925
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
926 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
927 * @see de.intevation.gnv.state.State#getDescibeData()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
928 */
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
929 public List<Object> getDescibeData(String uuid) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
930 CacheFactory factory = CacheFactory.getInstance();
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
931 if (factory.isInitialized()) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
932 // we use a cache
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
933 log.debug("Using cache.");
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
934 Cache cache = factory.getCache();
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
935 String key = getHash();
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
936
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
937 net.sf.ehcache.Element value = cache.get(key);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
938 if (value != null) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
939 // element already in cache, so return it.
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
940 log.debug("Found element in cache.");
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
941 return (List<Object>) (value.getObjectValue());
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
942 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
943 else {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
944 // element is not in cache yet, so we need to fetch data from
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
945 // database and put it into cache right now
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
946 log.debug("Element not in cache, we need to ask the database");
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
947 try {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
948 String[] filterValues = generateFilterValuesFromInputData();
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
949 List<Object> data = queryDatabase(filterValues, uuid);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
950
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
951 cache.put(new net.sf.ehcache.Element(key, data));
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
952 return data;
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
953 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
954 catch (QueryException qe) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
955 log.error(qe, qe);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
956 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
957 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
958 }
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
959 else {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
960 // we don't use a cache, so we have to query the database every
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
961 // single time
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
962 log.debug("Not using cache.");
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
963 String[] filterValues = generateFilterValuesFromInputData();
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
964 Collection<Result> result = null;
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
965 try {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
966 return queryDatabase(filterValues, uuid);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
967 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
968 catch (RuntimeException e) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
969 log.error(e, e);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
970 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
971 catch (QueryException e) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
972 log.error(e, e);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
973 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
974 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
975
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
976 return null;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
977 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
978
607
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
979 protected List<Object> queryDatabase(String[] filterValues, String uuid)
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
980 throws QueryException {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
981 Collection<Result> result = null;
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
982
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
983 if (queryID != null) {
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
984 QueryExecutor queryExecutor =
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
985 QueryExecutorFactory.getInstance().getQueryExecutor();
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
986
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
987 result = queryExecutor.executeQuery(queryID, filterValues);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
988 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
989 return purifyResult(result, uuid);
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
990 }
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
991
292fbcd5e9ac Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 605
diff changeset
992
473
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
993 public Map<String, InputData> inputData() {
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
994 return inputData;
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
995 }
a6a33ef35809 Added support to step back to previous states. Add state names to xform nodes in describe document and append old targets to list of reachable targets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 470
diff changeset
996
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
997 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
998 * @see de.intevation.gnv.state.State#getInputData()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
999 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1000 public Collection<InputData> getInputData() throws StateException {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1001 return this.inputData != null ? this.inputData.values() : null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1002 }
481
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 473
diff changeset
1003
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 473
diff changeset
1004 public void endOfLife(Object globalContext) {
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 473
diff changeset
1005 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1006 }
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
1007 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org