annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java @ 614:e80e37b78302

Repaired broken step-back-history. gnv-artifacts/trunk@684 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 12 Feb 2010 11:16:37 +0000
parents e86d37008fd1
children 01054ddccb0f
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
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 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
4 import java.util.Arrays;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5 import java.util.Collection;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6 import java.util.Date;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7 import java.util.GregorianCalendar;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8 import java.util.HashMap;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 import java.util.HashSet;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 import java.util.Iterator;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11 import java.util.List;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 import java.util.Map;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import java.util.Set;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
15 import javax.xml.xpath.XPathConstants;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
16
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
17 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
18
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 import org.apache.log4j.Logger;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import org.w3c.dom.Document;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 import org.w3c.dom.Element;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 import org.w3c.dom.Node;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 import org.w3c.dom.NodeList;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24
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
25 import de.intevation.artifactdatabase.Config;
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
26 import de.intevation.artifactdatabase.XMLUtils;
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
27 import de.intevation.artifacts.ArtifactNamespaceContext;
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
28 import de.intevation.artifacts.CallContext;
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
29 import de.intevation.artifacts.CallMeta;
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
30 import de.intevation.gnv.artifacts.GNVArtifactBase;
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
31 import de.intevation.gnv.artifacts.cache.CacheFactory;
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
32 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
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
33 import de.intevation.gnv.geobackend.base.Result;
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
34 import de.intevation.gnv.geobackend.base.query.QueryExecutor;
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 de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
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
36 import de.intevation.gnv.geobackend.base.query.exception.QueryException;
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
37 import de.intevation.gnv.geobackend.util.DateUtils;
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
38 import de.intevation.gnv.state.describedata.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
39 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
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
40 import de.intevation.gnv.state.describedata.MinMaxDescribeData;
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
41 import de.intevation.gnv.state.describedata.NamedArrayList;
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
42 import de.intevation.gnv.state.describedata.NamedCollection;
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
43 import de.intevation.gnv.state.describedata.SingleValueDescribeData;
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
44 import de.intevation.gnv.state.exception.StateException;
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
45 import de.intevation.gnv.utils.InputValidator;
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
46
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 /**
481
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 473
diff changeset
48 * @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
49 * @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
50 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 public abstract class StateBase implements State {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 * The UID of this Class
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57 private static final long serialVersionUID = 2411169179001645426L;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60 * the logger, used to log exceptions and additonaly information
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 private static Logger log = Logger.getLogger(GNVArtifactBase.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
63
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
64 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
65 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
66
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67 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
68
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
69 public final static String DESCRIBEDATAKEY = "_DESCRIBEDATA";
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
71 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
72 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
73
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 /** 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
75 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
76
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 private String id = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
79 protected String hash;
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
80
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 private String description = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83 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
84
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
85 protected String preSettingsName = null;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87 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
88
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 protected boolean dataNoSelect = false;
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 queryID = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93 protected Collection<String> inputValueNames = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94
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
95 protected Map<String, InputValue> inputValues = null;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
96
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
97 protected State parent = null;
335
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 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
100
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
101 protected Map<String, InputData> preSettings = null;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104 * Constructor
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
105 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106 public StateBase() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 super();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
110 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
111 * @see de.intevation.gnv.state.State#getID()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 public String getID() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
114 return this.id;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115 }
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 * @see de.intevation.gnv.state.State#getDescription()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
119 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
120 public String getDescription() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
121 return this.description;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122 }
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 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 * @see de.intevation.gnv.state.State#getRequiredInputValues()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
128 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
129 public Collection<InputValue> getRequiredInputValues() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
130 return this.inputValues.values();
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
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
133
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
134 public void reset(String uuid) {
614
e80e37b78302 Repaired broken step-back-history.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 612
diff changeset
135 inputData.remove(dataName);
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
136 }
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 464
diff changeset
137
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
138
335
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 * @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
141 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
142 public void setup(Node configuration) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
143 this.id = ((Element)configuration).getAttribute("id");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
144 this.description = ((Element)configuration).getAttribute("description");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
145
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
146 log.info("State-ID = " + this.id);
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 NodeList inputValuesNodes = Config.getNodeSetXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
149 "inputvalues/inputvalue");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
150 this.inputValues = new HashMap<String, InputValue>(inputValuesNodes
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
151 .getLength());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
152 this.inputValueNames = new ArrayList<String>(inputValuesNodes
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
153 .getLength());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
154 for (int i = 0; i < inputValuesNodes.getLength(); i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
155 Element inputValueNode = (Element)inputValuesNodes.item(i);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156 String usedinQueryValue = inputValueNode.getAttribute("usedinquery");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157 int usedinQuery = 1;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
158 if (usedinQueryValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
159 try {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160 usedinQuery = Integer.parseInt(usedinQueryValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
161 } catch (NumberFormatException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
162 log
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
163 .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
164 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
165 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
166 InputValue inputValue = new DefaultInputValue(inputValueNode.getAttribute("name"),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
167 inputValueNode.getAttribute("type"),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
168 Boolean.parseBoolean(inputValueNode.
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
169 getAttribute("multiselect")), usedinQuery);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
170 this.inputValues.put(inputValue.getName(), inputValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
171 this.inputValueNames.add(inputValue.getName());
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 this.queryID = Config.getStringXPath(configuration, "queryID");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
175 log.info("QueryID ==> " + this.queryID);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
176
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
177 this.dataName = Config.getStringXPath(configuration, "dataname");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
178
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
179 String dataMultiSelectValue = Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
180 "data-multiselect");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
181 if (dataMultiSelectValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
182 this.dataMultiSelect = Boolean.parseBoolean(dataMultiSelectValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
183 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
184
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
185 String dataNoSelectValue =Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
186 "data-noselect");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
187 if (dataNoSelectValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
188 this. dataNoSelect = Boolean.parseBoolean(dataNoSelectValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
189 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
190
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
191 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
192
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
193 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
194
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
195 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
196 * @see de.intevation.gnv.state.State#getParent()
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 public State getParent() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
199 return this.parent;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
200 }
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 * @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
204 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
205 public void setParent(State state) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
206 this.parent = state;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
207 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
208
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
209
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
210 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
211 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
212 {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
213 if (inputData != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
214 Iterator<InputData> it = inputData.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
215 InputValidator iv = new InputValidator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
216 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
217 InputData tmpItem = it.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
218 InputValue inputValue = this.inputValues.get(tmpItem.getName());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
219 if (inputValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
220 if (this.inputData == null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
221 this.inputData = new HashMap<String, InputData>(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
222 inputData.size());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
223 }
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
224
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
225 boolean valid = iv.isInputValid(tmpItem.getValue(),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
226 inputValue.getType());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
227 if (valid) {
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
228 String desc = getDescriptionForInputData(tmpItem, uuid);
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
229 tmpItem.setDescription(desc);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
230 this.inputData.put(tmpItem.getName(), tmpItem);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
231 } else {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
232 String errMsg = "Wrong input for " + tmpItem.getValue()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
233 + " is not an " + inputValue.getType()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
234 + " Value.";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
235 log.warn(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
236 throw new StateException(errMsg);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
237 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
238
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
239 } else {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
240 String errMsg = "No Inputvalue given for Inputdata "
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
241 + tmpItem.getName();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
242 log.warn(errMsg + "Value will be ignored");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
243
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
244 }
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 } else {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
247 log.warn("No Inputdata given");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
248 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
249 }
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
250
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
251
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
252 private String getDescriptionForInputData(InputData data, String uuid) {
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
253 // 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
254 Object obj = getDescibeData(uuid).get(0);
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
255
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
256 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
257 NamedArrayList list = (NamedArrayList) obj;
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
258 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
259
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
260 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
261 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
262
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
263 if (kv.getKey().equals(data.getValue())) {
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 return kv.getValue();
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 }
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 }
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
267 }
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
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 return data.getValue();
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 }
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
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
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
273 /**
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
274 * @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
275 */
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
276 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
277 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
278 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
279 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
280 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
281 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
282 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
283 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
284 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
285 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
286 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
287 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
288 }
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
289
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
290 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
291 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
292 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
293 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
294 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
295 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
296 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
297 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
298 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
299 + " 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
300 + " 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
301 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
302 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
303 }
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
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 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
306 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
307 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
308 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
309 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
310 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
311 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
312 }
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 }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
314 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
315 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
316 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
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 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
319 + " 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
320 + " 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
321 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
322 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
323 }
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
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 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
326 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
327 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
328 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
329 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
330 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
331 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
332 }
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 }
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 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
335 } 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
336 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
337 + " 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
338 + " 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
339 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
340 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
341 }
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
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 } 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
344 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
345 + 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
346 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
347
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 } 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
351 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
352 }
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
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
354 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
355 }
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
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 /**
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
359 *
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
360 * @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
361 */
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
362 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
363 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
364 }
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
365
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
366
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
367
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
368 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
369 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
370 }
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
371
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 609
diff changeset
372 protected String getInputValue4ID(Collection<InputData> inputData, String inputName){
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
373 Iterator<InputData> it = inputData.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
374 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
375 InputData tmpItem = it.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
376 if (tmpItem.getName().equals(inputName)){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
377 return tmpItem.getValue();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
378 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
379 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
380 return null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
381 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
382
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
383
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
384 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
385 * @see de.intevation.gnv.state.State#advance(java.lang.String,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
386 * de.intevation.artifacts.CallMeta)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
387 */
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
388 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
389 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
390 {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
391 }
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
392
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
393 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
394 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
395 {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
396 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
397
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
398 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
399 * @return
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
400 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
401 protected String[] generateFilterValuesFromInputData() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
402 List<String> list = new ArrayList<String>();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
403 Iterator<String> it = this.inputValueNames.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
404 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
405 String value = it.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
406 InputData data = this.inputData.get(value);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
407 if (data != null
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
408 && this.inputValues.containsKey(data.getName())) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
409 int size = this.inputValues.get(data.getName())
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
410 .usedInQueries();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
411 String type = this.inputValues.get(data.getName())
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
412 .getType();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
413 String requestValue = data.getValue();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
414 if (type.equalsIgnoreCase("string")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
415 requestValue = this
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
416 .prepareInputData4DBQuery(requestValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
417 } else if (type.equalsIgnoreCase("date")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
418 requestValue = this
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
419 .prepareInputData4DateDBQuery(requestValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
420 } else if (type.equalsIgnoreCase("coordinate")){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
421 requestValue = this
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
422 .prepareInputData4RegionDBQuery(requestValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
423 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
424 for (int j = 0; j < size; j++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
425 list.add(requestValue);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
426 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
427 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
428 }
428
88cd37c3b5e4 Adjusted sql queries and configuration for verticalcrosssection products. Some code refactoring and improved error handling.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 337
diff changeset
429 String[] filterValues = list.toArray(new String[list.size()]);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
430 return filterValues;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
431 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
432
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
433 protected String prepareInputData4RegionDBQuery(String value){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
434 return value;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
435 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
436
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
437 private String prepareInputData4DateDBQuery(String value) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
438 if (value != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
439 String[] values = value.split(",");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
440 String newValue = "";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
441 for (int i = 0; i < values.length; i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
442 if (newValue.length() > 0) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
443 newValue = newValue + " , ";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
444 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
445 // TODO JUST HACK FIND A BETTER RESOLUTION
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
446 newValue = newValue + "to_date('" + values[i].trim()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
447 + "', 'YYYY.MM.DD HH24:MI:SS')";
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 return newValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
450 }
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 return value;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
453 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
454
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
455 private String prepareInputData4DBQuery(String value) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
456 if (value != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
457 String[] values = value.split(",");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
458 String newValue = "";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
459 for (int i = 0; i < values.length; i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
460 if (newValue.length() > 0) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
461 newValue = newValue + " , ";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
462 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
463 newValue = newValue + "'" + values[i].trim() + "'";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
464 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
465 return newValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
466 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
467
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
468 return value;
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 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
471
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
472 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
473 * @param result
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
474 */
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
475 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
476 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
477
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
478 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
479 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
480
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
481 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
482
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
483 return describeData;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
484 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
485
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
486 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
487 * @param result
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
488 * @return
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 protected NamedCollection<KeyValueDescibeData> extractKVP(Collection<Result> result,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
491 String keyid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
492 String valueid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
493 Iterator<Result> rit = result.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
494 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
495
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
496 NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
497 this.dataName, dataSize);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
498 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
499
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
500 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
501 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
502 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
503 "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
504 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
505 ));
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
506 }
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
507
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
508 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
509 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
510 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
511 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
512 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
513 (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
514 ? 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
515 : 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
516 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
517
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
518 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
519 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
520 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
521 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
522 while (rit.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
523 Result resultValue = rit.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
524 if (!initialized){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
525 keyPos = resultValue.getResultDescriptor().getColumnIndex(keyid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
526 valuePos = resultValue.getResultDescriptor().getColumnIndex(valueid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
527 if (valuePos < 0){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
528 valuePos = 1;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
529 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
530 initialized = true;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
531 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
532 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
533
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
534 // 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
535 // support a distinct Query on Layers.
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
536 if (previousKey == null || !tmpKey.equals(previousKey)){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
537 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
538 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
539 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
540 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
541 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
542 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
543 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
544 );
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 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
546 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
547 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
548 return keyValueDescibeData;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
549 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
550
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
551
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
552 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
553 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
554 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
555 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
556 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
557 }
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
558 }
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
559
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
560 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
561 }
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
562
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
563 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
564 * @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
565 * org.w3c.dom.Node, de.intevation.artifacts.CallMeta,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
566 * java.lang.String)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
567 */
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
568 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
569 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
570 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
571 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
572 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
573 {
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
574 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
575 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
576 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
577 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
578 );
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
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 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
581 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
582 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
583 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
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
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 // 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
587 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
588 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
589 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
590 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
591 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
592 );
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
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 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
595 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
596
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 // 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
598 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
599 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
600 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
601 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
602 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
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 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
606 creator,xCreator, 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
607 }
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
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 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
611 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
612 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
613 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
614 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
615 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
616 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
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 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
619
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
620 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
621 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
622
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
623 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
624 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
625 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
626
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 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
628 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
629 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
630 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
631 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
632 }
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
633 }
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
634 }
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 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
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 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
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 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
647 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
648 ((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
649 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
650 }
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
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 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
653 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
654 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
655
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
656
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
657 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
658 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
659 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
660 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
661 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
662 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
663 ) {
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
664 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
665
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
666 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
667 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
668 }
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
669
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
670 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
671 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
672
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 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
674 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
675 .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
676 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
677
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 /* TODO InputData can have more than 1 value if multiselect, implement a
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 * loop over these values
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
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
681 while (resultIt.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
682 KeyValueDescibeData result = resultIt.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
683 */
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
684
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
685 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
686 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
687 );
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
688
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
689 Element itemNode = creator.create("item");
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
690
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
691 creator.addAttr(itemNode, "selected", "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
692
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
693 Element choiceLableNode = creator.create("label");
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 choiceLableNode.setTextContent(data.getDescription());
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 itemNode.appendChild(choiceLableNode);
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
696
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 Element choiceValueNode = creator.create("value");
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 choiceValueNode.setTextContent(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
699 itemNode.appendChild(choiceValueNode);
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 choiceNode.appendChild(itemNode);
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 /*
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
702 }
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
703 */
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 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
705 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
706
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 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
708 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
709
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
710
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
711 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
712 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
713 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
714 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
715 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
716 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
717 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
718 ) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
719 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
720 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
721 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
722 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
723 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
724 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
725 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
726 } 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
727 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
728 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
729 }
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
730
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
731 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
732 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
733
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
734 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
735 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
736 .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
737 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
738
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
739 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
740 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
741 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
742 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
743 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
744
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes 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 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
746 itemNode.setAttribute("selected", "true");
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
747 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
748
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
749 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
750 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
751 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
752
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
753 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
754 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
755 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
756 choiceNode.appendChild(itemNode);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
757 }
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
758 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
759 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
760
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
761 dynamicNode.appendChild(selectNode);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
762 }
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
763 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
764 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
765 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
766 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
767 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
768 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
769 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
770 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
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 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
773 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
774 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
775 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
776 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
777 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
778 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
779 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
780 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes 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 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes 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
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes 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
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
784 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
785 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
786 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
787 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
788 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
789 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
790 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
791 ) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
792 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
793 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
794 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
795 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
796 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
797 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
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
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes 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 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
801 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
802 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
803 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes 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
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
805 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
806 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
807
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
808 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
809 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
810 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
811 .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
812 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
813 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
814 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
815 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
816
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
817 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
818 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
819 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
820 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
821 .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
822 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
823 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
824 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
825
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
826 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
827 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
828 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
829
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
830 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
831 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
832 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
833 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
834 .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
835 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
836 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
837 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
838
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
839 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
840 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
841 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
842
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes 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 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
844 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
845
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
846 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
847 }
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes 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
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes 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
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes 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 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
851 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
852 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
853 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
854 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
855 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
856 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
857 ) {
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
858 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
859
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
860 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
861 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
862 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
863
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
864 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
865 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
866 .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
867 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
868 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
869 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
870 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
871
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
872 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
873 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
874
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
875 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
876 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
877 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
878
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 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
880 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
881 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
882
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 428
diff changeset
883 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
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 node.appendChild(groupNode);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
886 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
887
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
888
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
889 protected void setHash(String uuid) {
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
890 this.hash = uuid + id + inputData.hashCode();
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
891 }
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
892
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
893
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
894 protected String getHash() {
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
895 return this.hash;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
896 }
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
897
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
898
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
899 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
900 * @see de.intevation.gnv.state.State#getDescibeData()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
901 */
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
902 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
903 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
904 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
905 // we use a cache
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
906 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
907 Cache cache = factory.getCache();
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
908 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
909
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
910 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
911 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
912 // 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
913 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
914 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
915 }
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
916 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
917 // 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
918 // 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
919 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
920 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
921 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
922 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
923
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
924 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
925
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
926 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
927 }
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
928 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
929 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
930 }
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 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
932 }
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
933 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
934 // 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
935 // single time
609
22e65fb4c64a Improved hash creation in each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 608
diff changeset
936 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
937 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
938 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
939 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
940 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
941 }
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 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
943 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
944 }
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 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
946 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
947 }
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 }
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
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 return null;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
951 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
952
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
953 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
954 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
955 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
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 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
958 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
959 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
960
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 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
962 }
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 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
964 }
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
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
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
967 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
968 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
969 }
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
970
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
971 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
972 * @see de.intevation.gnv.state.State#getInputData()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
973 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
974 public Collection<InputData> getInputData() throws StateException {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
975 return this.inputData != null ? this.inputData.values() : null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
976 }
481
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 473
diff changeset
977
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 473
diff changeset
978 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
979 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
980 }
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
981 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org