annotate gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java @ 120:5134266f00e7

Resolved gnv/issue21 No NPE will be thrown. Add Dummydata for Calculating the distance between two MeasurmentPoints. gnv-artifacts/trunk@190 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 06 Oct 2009 10:58:47 +0000
parents 5ebc059064a6
children 7fb9441dd8af
rev   line source
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 *
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 package de.intevation.gnv.transition;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6 import java.util.ArrayList;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7 import java.util.Collection;
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
8 import java.util.Date;
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
9 import java.util.GregorianCalendar;
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
10 import java.util.HashMap;
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
11 import java.util.HashSet;
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
12 import java.util.Iterator;
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
13 import java.util.List;
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
14 import java.util.Map;
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
15 import java.util.Set;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17 import org.apache.log4j.Logger;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 import org.w3c.dom.Document;
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
19 import org.w3c.dom.Element;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import org.w3c.dom.Node;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 import org.w3c.dom.NodeList;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 import de.intevation.artifactdatabase.Config;
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
24 import de.intevation.artifacts.CallMeta;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 import de.intevation.gnv.artifacts.GNVArtifactBase;
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
26 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
27 import de.intevation.gnv.geobackend.base.Result;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
28 import de.intevation.gnv.geobackend.base.query.QueryExecutor;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
29 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
30 import de.intevation.gnv.geobackend.base.query.exception.QueryException;
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
31 import de.intevation.gnv.geobackend.util.DateUtils;
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 63
diff changeset
32 import de.intevation.gnv.transition.describedata.DefaultKeyValueDescribeData;
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 63
diff changeset
33 import de.intevation.gnv.transition.describedata.KeyValueDescibeData;
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
34 import de.intevation.gnv.transition.describedata.MinMaxDescribeData;
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
35 import de.intevation.gnv.transition.describedata.NamedArrayList;
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
36 import de.intevation.gnv.transition.describedata.NamedCollection;
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
37 import de.intevation.gnv.transition.describedata.SingleValueDescribeData;
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
38 import de.intevation.gnv.transition.exception.TransitionException;
76
2473440671ce Integrate UI-Representation for Describe into the FISArtifact.
Tim Englich <tim.englich@intevation.de>
parents: 68
diff changeset
39 import de.intevation.gnv.utils.ArtifactXMLUtilities;
101
e01c163ea5b0 Inputvalidation for String, Integer and Date Values added.
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
40 import de.intevation.gnv.utils.InputValidator;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43 * @author Tim Englich <tim.englich@intevation.de>
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 *
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 public abstract class TransitionBase implements Transition {
77
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
47
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
48 /**
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
49 * The UID of this Class
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
50 */
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
51 private static final long serialVersionUID = 2411169179001645426L;
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
52
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 * the logger, used to log exceptions and additonaly information
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 private static Logger log = Logger.getLogger(GNVArtifactBase.class);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 private String id = null;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59
53
e464d9f9d967 Added getDescription to a Transition
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
60 private String description = null;
e464d9f9d967 Added getDescription to a Transition
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
61
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
62 protected String dataName = null;
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
63
116
820238357bab Added Horizontal-Profile-Support for Meshes.
Tim Englich <tim.englich@intevation.de>
parents: 101
diff changeset
64 protected boolean dataMultiSelect = false;
53
e464d9f9d967 Added getDescription to a Transition
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
65
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 protected String queryID = null;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 private Collection<String> reachableTransitions = null;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
70 protected Collection<String> inputValueNames = null;
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
71
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
72 private Map<String,InputValue> inputValues = null;
55
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
73
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 private Transition parent = null;
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
75
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
76 protected Map<String,InputData> inputData = null;
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
77
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
78 protected Collection<Object> descibeData = null;
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
79
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 * Constructor
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83 public TransitionBase() {
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 super();
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
88 * @see de.intevation.gnv.transition.Transition#getID()
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90 public String getID() {
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 return this.id;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92 }
53
e464d9f9d967 Added getDescription to a Transition
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
93
e464d9f9d967 Added getDescription to a Transition
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
94 /**
e464d9f9d967 Added getDescription to a Transition
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
95 * @see de.intevation.gnv.transition.Transition#getDescription()
e464d9f9d967 Added getDescription to a Transition
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
96 */
e464d9f9d967 Added getDescription to a Transition
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
97 public String getDescription() {
e464d9f9d967 Added getDescription to a Transition
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
98 return this.description;
e464d9f9d967 Added getDescription to a Transition
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
99 }
e464d9f9d967 Added getDescription to a Transition
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
100
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102 * @see de.intevation.gnv.transition.Transition#reachableTransitions()
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104 public Collection<String> reachableTransitions() {
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
105 return this.reachableTransitions;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 /**
55
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
109 * @see de.intevation.gnv.transition.Transition#getRequiredInputValues()
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
110 */
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
111 public Collection<InputValue> getRequiredInputValues() {
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
112 return this.inputValues.values();
55
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
113 }
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
114
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
115 /**
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
116 * @see de.intevation.gnv.transition.Transition#setup(org.w3c.dom.Node)
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
117 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
118 public void setup(Node configuration) {
118
5ebc059064a6 Adding Languagetransfer to the ArtifactDatabase to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
119 log.debug("TransitionBase.setup");
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
120 this.id = Config.getStringXPath(configuration,"@id");
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 53
diff changeset
121 this.description = Config.getStringXPath(configuration,"@description");
53
e464d9f9d967 Added getDescription to a Transition
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
122
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 log.info("Transition-ID = "+ this.id);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124 NodeList nodes = Config.getNodeSetXPath(configuration,"reachableTransitions/transition");
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
125 this.reachableTransitions = new ArrayList<String>(nodes.getLength());
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
126 for (int i = 0 ; i < nodes.getLength(); i++){
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 String reachableTransition = nodes.item(i).getTextContent();
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
128 log.info("ReachableTransition ==> "+ reachableTransition);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
129 this.reachableTransitions.add(reachableTransition);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
130
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
131 }
55
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
132
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
133 NodeList inputValuesNodes = Config.getNodeSetXPath(configuration,"inputvalues/inputvalue");
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
134 this.inputValues = new HashMap<String,InputValue>(inputValuesNodes.getLength());
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
135 this.inputValueNames = new ArrayList<String>(inputValuesNodes.getLength());
55
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
136 for (int i = 0 ; i < inputValuesNodes.getLength(); i++){
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
137 Node inputValueNode = inputValuesNodes.item(i);
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
138 String usedinQueryValue = Config.getStringXPath(inputValueNode,"@usedinquery");
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
139 int usedinQuery = 1;
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
140 if (usedinQueryValue != null){
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
141 try {
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
142 usedinQuery = Integer.parseInt(usedinQueryValue);
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
143 } catch (NumberFormatException e) {
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
144 log.warn("Used in Query Value cannot be transformed into a Number");
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
145 }
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
146 }
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
147 InputValue inputValue = new DefaultInputValue(
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
148 Config.getStringXPath(inputValueNode,"@name"),
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
149 Config.getStringXPath(inputValueNode,"@type"),
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
150 Boolean.parseBoolean(Config.getStringXPath(inputValueNode,"@multiselect")),
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
151 usedinQuery);
56
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 55
diff changeset
152 log.debug(inputValue.toString());
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
153 this.inputValues.put(inputValue.getName(),inputValue);
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
154 this.inputValueNames.add(inputValue.getName());
55
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
155 }
6ded86ce30dd Constructs for the required Inputvalues for an Transition created
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
156
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157 this.queryID = Config.getStringXPath(configuration,"queryID");
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
158 log.info("QueryID ==> "+ this.queryID);
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
159
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
160 this.dataName = Config.getStringXPath(configuration,"dataname");
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
161
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
162 String dataMultiSelectValue = Config.getStringXPath(configuration,"data-multiselect");
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
163 if (dataMultiSelectValue != null){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
164 this.dataMultiSelect = Boolean.parseBoolean(dataMultiSelectValue);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
165 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
166
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
167 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
168
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
169 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
170 * @see de.intevation.gnv.transition.Transition#getParent()
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
171 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
172 public Transition getParent() {
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
173 return this.parent;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
174 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
175
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
176 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
177 * @see de.intevation.gnv.transition.Transition#setParent(de.intevation.gnv.transition.Transition)
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
178 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
179 public void setParent(Transition transition) {
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
180 this.parent = transition;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
181 }
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
182
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
183 /**
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
184 * @see de.intevation.gnv.transition.Transition#putInputData(java.util.Collection)
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
185 */
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
186 public void putInputData(Collection<InputData> inputData, String uuid) throws TransitionException {
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
187 log.debug("TransitionBase.putInputData");
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
188 if (inputData != null){
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
189 Iterator<InputData> it = inputData.iterator();
101
e01c163ea5b0 Inputvalidation for String, Integer and Date Values added.
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
190 InputValidator iv = new InputValidator();
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
191 while(it.hasNext()){
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
192 InputData tmpItem = it.next();
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
193 InputValue inputValue = this.inputValues.get(tmpItem.getName());
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
194 if (inputValue != null){
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
195 if (this.inputData == null){
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
196 this.inputData = new HashMap<String,InputData>(inputData.size());
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
197 }
101
e01c163ea5b0 Inputvalidation for String, Integer and Date Values added.
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
198 boolean valid = iv.isInputValid(tmpItem.getValue(), inputValue.getType());
e01c163ea5b0 Inputvalidation for String, Integer and Date Values added.
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
199 if (valid){
e01c163ea5b0 Inputvalidation for String, Integer and Date Values added.
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
200 this.setSelection(tmpItem);
e01c163ea5b0 Inputvalidation for String, Integer and Date Values added.
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
201 this.inputData.put(tmpItem.getName(),tmpItem);
e01c163ea5b0 Inputvalidation for String, Integer and Date Values added.
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
202 }else{
e01c163ea5b0 Inputvalidation for String, Integer and Date Values added.
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
203 String errMsg = "Wrong input for "+tmpItem.getValue()+"is not an "+inputValue.getType()+" Value.";
e01c163ea5b0 Inputvalidation for String, Integer and Date Values added.
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
204 log.warn(errMsg);
e01c163ea5b0 Inputvalidation for String, Integer and Date Values added.
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
205 throw new TransitionException(errMsg);
e01c163ea5b0 Inputvalidation for String, Integer and Date Values added.
Tim Englich <tim.englich@intevation.de>
parents: 99
diff changeset
206 }
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
207
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
208 }else{
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
209 String errMsg = "No Inputvalue given for Inputdata "+ tmpItem.getName();
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
210 log.warn(errMsg+ "Value will be ignored");
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
211
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
212 }
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
213 }
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
214 }else{
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
215 log.warn("No Inputdata given");
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
216 }
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
217 }
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
218
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
219 private void setSelection(InputData inputData){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
220 log.debug("TransitionBase.setSelection");
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
221
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
222 Object o = this.getDescribeData(inputData.getName());
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
223 if(o != null){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
224 if (o instanceof Collection<?>){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
225 Collection<KeyValueDescibeData> values = (Collection<KeyValueDescibeData>)o;
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
226
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
227 String value = inputData.getValue();
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
228 String[] selectedValues = value.split(",");
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
229 Set<String> selectedItems = new HashSet<String>(selectedValues.length);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
230 for (int i = 0; i < selectedValues.length; i++){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
231 selectedItems.add(selectedValues[i].trim());
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
232 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
233 // Selektion umsetzen
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
234 Iterator<KeyValueDescibeData> it = values.iterator();
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
235 while (it.hasNext()){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
236 KeyValueDescibeData data = it.next();
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
237 String key = ""+data.getKey();
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
238 boolean selected = selectedItems.contains(key);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
239 data.setSelected(selected);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
240 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
241 }else if (o instanceof MinMaxDescribeData){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
242 MinMaxDescribeData data = (MinMaxDescribeData)o;
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
243 if (inputData.getName().equals(data.getMinName())){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
244 // TODO: m�ssen die werte geparst werden?
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
245 data.setMinValue(inputData.getValue());
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
246 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
247 if (inputData.getName().equals(data.getMaxName())){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
248 // TODO: m�ssen die werte geparst werden?
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
249 data.setMaxValue(inputData.getValue());
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
250 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
251 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
252 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
253 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
254
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
255 private Object getDescribeData(String name){
118
5ebc059064a6 Adding Languagetransfer to the ArtifactDatabase to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
256 log.debug("TransitionBase.getDescribeData");
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
257 if (this.descibeData != null){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
258 Iterator<Object> it = this.descibeData.iterator();
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
259 while (it.hasNext()){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
260 Object o = it.next();
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
261 if (o instanceof NamedCollection<?>){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
262 if (name.equals(((NamedCollection<?>)o).getName())){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
263 return o;
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
264 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
265 }else if (o instanceof MinMaxDescribeData){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
266 if (name.equals(((MinMaxDescribeData)o).getMinName())){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
267 return o;
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
268 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
269 if (name.equals(((MinMaxDescribeData)o).getMaxName())){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
270 return o;
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
271 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
272 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
273 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
274 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
275 return null;
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
276
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
277 }
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
278
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
279 /**
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
280 * @see de.intevation.gnv.transition.Transition#isTransitionReachable(java.lang.String)
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
281 */
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
282 public boolean isTransitionReachable(String transitionID) {
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
283 log.debug("TransitionBase.isTransitionReachable");
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
284 boolean returnValue = false;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
285 Iterator<String> transitions = reachableTransitions.iterator();
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
286 while (transitions.hasNext()){
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
287 if(transitions.next().equals(transitionID)){
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
288 log.debug("Transition "+transitionID+" wird unterst�tzt.");
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
289 returnValue = true;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
290 break;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
291 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
292 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
293 return returnValue;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
294 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
295
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
296 /**
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
297 * @see de.intevation.gnv.transition.Transition#advance(java.lang.String, de.intevation.artifacts.CallMeta)
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
298 */
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
299 public void advance(String uuid, CallMeta callMeta) throws TransitionException {
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
300 log.debug("TransitionBase.advance");
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
301 try {
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
302 List<String> list = new ArrayList<String>();
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
303
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
304
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
305 Iterator<String> it = this.inputValueNames.iterator();
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
306 int i = 0;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
307 while (it.hasNext()){
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
308 String value = it.next();
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
309 InputData data = this.inputData.get(value);
83
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
310 if (data != null && this.inputValues.containsKey(data.getName())){
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
311 int size = this.inputValues.get(data.getName()).usedInQueries();
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
312 String type = this.inputValues.get(data.getName()).getType();
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
313 String requestValue = data.getValue();
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
314 if (type.equalsIgnoreCase("string")){
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
315 requestValue = this.prepareInputData4DBQuery(requestValue);
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
316 }else if (type.equalsIgnoreCase("date")){
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
317 requestValue = this.prepareInputData4DateDBQuery(requestValue);
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
318 }
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
319 for (int j = 0; j < size; j++){
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
320 list.add(requestValue);
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
321 }
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
322 }
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
323 }
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
324 String[] filterValues = list.toArray(new String[0]);
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
325 Collection<Result> result = null;
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
326 try {
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
327 if (this.queryID != null){
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
328 QueryExecutor queryExecutor = QueryExecutorFactory.getInstance().getQueryExecutor();
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
329 result = queryExecutor.executeQuery(this.queryID, filterValues);
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
330 }
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
331 this.purifyResult(result, uuid);
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
332 } catch (RuntimeException e) {
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
333 log.error(e,e);
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
334 }
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
335 } catch (QueryException e) {
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
336 log.error(e,e);
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
337 throw new TransitionException(e);
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
338 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
339 }
83
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
340
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
341 private String prepareInputData4DateDBQuery(String value){
118
5ebc059064a6 Adding Languagetransfer to the ArtifactDatabase to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
342 log.debug("TransitionBase.prepareInputData4DateDBQuery");
83
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
343 if (value != null){
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
344 String[] values = value.split(",");
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
345 String newValue = "";
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
346 for (int i = 0; i < values.length; i++){
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
347 if (newValue.length() > 0){
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
348 newValue= newValue + " , ";
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
349 }
88
1b12021905b9 Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents: 84
diff changeset
350 // TODO JUST HACK FIND A BETTER RESOLUTION
1b12021905b9 Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents: 84
diff changeset
351 newValue = newValue + "to_date('"+values[i].trim()+"', 'YYYY.MM.DD HH24:MI:SS')";
83
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
352 }
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
353 return newValue;
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
354 }
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
355
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
356 return value;
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
357 }
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
358 private String prepareInputData4DBQuery(String value){
118
5ebc059064a6 Adding Languagetransfer to the ArtifactDatabase to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
359 log.debug("TransitionBase.prepareInputData4DBQuery");
83
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
360 if (value != null){
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
361 String[] values = value.split(",");
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
362 String newValue = "";
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
363 for (int i = 0; i < values.length; i++){
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
364 if (newValue.length() > 0){
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
365 newValue= newValue + " , ";
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
366 }
84
c8d1f7b9e5a8 Bugfixed in Querypreparation
Tim Englich <tim.englich@intevation.de>
parents: 83
diff changeset
367 newValue = newValue + "'"+values[i].trim()+"'";
83
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
368 }
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
369 return newValue;
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
370 }
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
371
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
372 return value;
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
373
5c8e54726a58 Added Support for Vertical Profiles Mesh
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
374 }
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
375
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
376 /**
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
377 * @param result
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
378 */
99
bb45c5097cb6 ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
379 protected void purifyResult(Collection<Result> result, String uuid) {
118
5ebc059064a6 Adding Languagetransfer to the ArtifactDatabase to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
380 log.debug("TransitionBase.purifyResult");
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
381 if (this.descibeData == null){
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
382 this.descibeData = new ArrayList<Object>();
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
383 }
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
384 Iterator<Result> rit = result.iterator();
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
385 NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>(this.dataName,result.size());
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
386 keyValueDescibeData.setMultiSelect(this.dataMultiSelect);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
387 while(rit.hasNext()){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
388 Result resultValue = rit.next();
82
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
389 keyValueDescibeData.add(new DefaultKeyValueDescribeData(resultValue.getString("KEY"), resultValue.getString("VALUE")));
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 63
diff changeset
390 }
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 63
diff changeset
391 this.descibeData.add(keyValueDescibeData);
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
392 }
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
393
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
394 /**
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
395 * @see de.intevation.gnv.transition.Transition#describe(org.w3c.dom.Document, org.w3c.dom.Node, de.intevation.artifacts.CallMeta)
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
396 */
117
ef157bd2fa92 LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents: 116
diff changeset
397 public void describe(Document document, Node rootNode, CallMeta callMeta) {
118
5ebc059064a6 Adding Languagetransfer to the ArtifactDatabase to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
398 log.debug("TransitionBase.describe");
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
399 if(this.descibeData != null){
76
2473440671ce Integrate UI-Representation for Describe into the FISArtifact.
Tim Englich <tim.englich@intevation.de>
parents: 68
diff changeset
400 ArtifactXMLUtilities xmlutilities = new ArtifactXMLUtilities();
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
401 Iterator<Object> it = this.descibeData.iterator();
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
402 Node staticNode = xmlutilities.createArtifactElement(document, "static");
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
403 Node dynamic = xmlutilities.createArtifactElement(document, "dynamic");
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
404 rootNode.appendChild(staticNode);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
405 rootNode.appendChild(dynamic);
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
406 while (it.hasNext()){
77
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
407
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
408 Object o = it.next();
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
409 if (o instanceof Collection<?>){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
410 String name = null;
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
411 boolean multiselect = false;
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
412 if (o instanceof NamedCollection<?>){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
413 NamedCollection<?> nc = ((NamedCollection<?>)o);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
414 name = nc.getName();
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
415 multiselect = nc.isMultiSelect();
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
416 }else{
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
417 Object[] names = this.inputValueNames.toArray();
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
418 name = names[names.length-1].toString();
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
419 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
420
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
421
78
969faa37a11b Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents: 77
diff changeset
422 Element selectNode = xmlutilities.createXFormElement(document,multiselect ? "select" : "select1");
77
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
423 selectNode.setAttribute("ref", name);
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
424
77
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
425 Element lableNode = xmlutilities.createXFormElement(document, "label");
118
5ebc059064a6 Adding Languagetransfer to the ArtifactDatabase to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
426 lableNode.setTextContent(RessourceFactory.getInstance().getRessource(callMeta.getLanguages(), name, name));
77
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
427 Element choiceNode = xmlutilities.createXFormElement(document, "choices");
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
428
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
429 Collection<KeyValueDescibeData> values = (Collection<KeyValueDescibeData>)o;
77
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
430 Iterator<KeyValueDescibeData> resultIt = values.iterator();
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
431 while (resultIt.hasNext()){
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
432 KeyValueDescibeData result = resultIt.next();
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
433 Element itemNode = xmlutilities.createXFormElement(document, "item");
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
434
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
435 if (result.isSelected()){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
436 itemNode.setAttribute("selected", "true");
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
437 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
438
77
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
439
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
440 Element choiceLableNode = xmlutilities.createXFormElement(document, "label");
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
441 choiceLableNode.setTextContent(result.getValue());
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
442 itemNode.appendChild(choiceLableNode);
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
443
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
444 Element choicValueNode = xmlutilities.createXFormElement(document, "value");
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
445 choicValueNode.setTextContent(""+result.getKey());
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
446 itemNode.appendChild(choicValueNode);
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
447 choiceNode.appendChild(itemNode);
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
448 }
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
449 selectNode.appendChild(lableNode);
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
450 selectNode.appendChild(choiceNode);
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
451
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
452 if (!it.hasNext()){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
453 dynamic.appendChild(selectNode);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
454 }else{
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
455 staticNode.appendChild(selectNode);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
456 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
457
77
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
458 }else if (o instanceof MinMaxDescribeData){
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
459 MinMaxDescribeData descibeData = (MinMaxDescribeData)o;
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
460 Object min = descibeData.getMinValue();
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
461 Object max = descibeData.getMaxValue();
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
462 if (min instanceof GregorianCalendar){
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
463 Date d = ((GregorianCalendar)min).getTime();
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
464 min = DateUtils.getPatternedDateAmer(d);
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
465 }
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
466
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
467 if (max instanceof GregorianCalendar){
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
468 Date d = ((GregorianCalendar)max).getTime();
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
469 max = DateUtils.getPatternedDateAmer(d);
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
470 }
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
471
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
472 Element inputMinNode = xmlutilities.createXFormElement(document, "input");
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
473 inputMinNode.setAttribute("ref", "minvalue");
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
474 Element inputMinLableNode = xmlutilities.createXFormElement(document, "label");
118
5ebc059064a6 Adding Languagetransfer to the ArtifactDatabase to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
475 inputMinLableNode.setTextContent(RessourceFactory.getInstance().getRessource(callMeta.getLanguages(), "minvalue", "minvalue"));
77
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
476 inputMinNode.appendChild(inputMinLableNode);
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
477
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
478 Element inputMinValueNode = xmlutilities.createXFormElement(document, "value");
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
479 inputMinValueNode.setTextContent(min.toString());
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
480 inputMinNode.appendChild(inputMinValueNode);
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
481
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
482 Element inputMaxNode = xmlutilities.createXFormElement(document, "input");
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
483 inputMaxNode.setAttribute("ref", "maxvalue");
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
484 Element inputMaxLableNode = xmlutilities.createXFormElement(document, "label");
118
5ebc059064a6 Adding Languagetransfer to the ArtifactDatabase to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
485 inputMaxLableNode.setTextContent(RessourceFactory.getInstance().getRessource(callMeta.getLanguages(), "maxvalue", "maxvalue"));
77
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
486 inputMaxNode.appendChild(inputMaxLableNode);
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
487
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
488 Element inputMaxValueNode = xmlutilities.createXFormElement(document, "value");
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
489 inputMaxValueNode.setTextContent(max.toString());
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
490 inputMaxNode.appendChild(inputMaxValueNode);
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
491
0e38f512f7e4 Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
492
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
493 if (!it.hasNext()){
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
494 dynamic.appendChild(inputMinNode);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
495 dynamic.appendChild(inputMaxNode);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
496 }else{
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
497 staticNode.appendChild(inputMinNode);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
498 staticNode.appendChild(inputMaxNode);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 78
diff changeset
499 }
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
500 }else if (o instanceof SingleValueDescribeData){
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
501
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
502 SingleValueDescribeData svdb = (SingleValueDescribeData)o;
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
503
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
504 Element inputNode = xmlutilities.createXFormElement(document, "input");
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
505 inputNode.setAttribute("ref", svdb.getName());
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
506
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
507 Element inputLableNode = xmlutilities.createXFormElement(document, "label");
118
5ebc059064a6 Adding Languagetransfer to the ArtifactDatabase to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 117
diff changeset
508 inputLableNode.setTextContent(RessourceFactory.getInstance().getRessource(callMeta.getLanguages(), svdb.getName(), svdb.getName()));
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
509 inputNode.appendChild(inputLableNode);
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
510
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
511 Element inputValueNode = xmlutilities.createXFormElement(document, "value");
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
512 inputValueNode.setTextContent(svdb.getValue());
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
513 inputNode.appendChild(inputValueNode);
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
514
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
515
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
516 if (!it.hasNext()){
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
517 dynamic.appendChild(inputNode);
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
518 }else{
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
519 staticNode.appendChild(inputNode);
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
520 }
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
521 }
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
522
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
523 }
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
524 }
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
525 }
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
526
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
527 /**
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
528 * @see de.intevation.gnv.transition.Transition#getDescibeData()
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
529 */
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
530 public Collection<Object> getDescibeData() {
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
531 return this.descibeData;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
532 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
533
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
534 /**
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
535 * @see de.intevation.gnv.transition.Transition#setDescibeData(java.util.Collection)
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
536 */
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
537 public void setDescibeData(Collection<Object> descibeData) {
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
538 this.descibeData = descibeData;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
539
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
540 }
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
541
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
542 /**
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
543 * @see de.intevation.gnv.transition.Transition#getInputData()
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
544 */
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
545 public Collection<InputData> getInputData() throws TransitionException {
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
546 return this.inputData != null ? this.inputData.values() : null;
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
547 }
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
548 }

http://dive4elements.wald.intevation.org