annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 631:a9af60c84dca

Small bugfixes in the WQ selection state. flys-artifacts/trunk@1996 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 24 May 2011 13:24:24 +0000
parents 51b69bca4560
children d8c47520c726
rev   line source
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
623
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
3 import java.util.Collection;
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
4 import java.util.HashMap;
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import java.util.List;
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
6 import java.util.Map;
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
7 import java.util.Set;
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
8 import java.util.Vector;
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
9
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
10 import javax.xml.xpath.XPathConstants;
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
379
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
12 import gnu.trove.TDoubleArrayList;
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
13
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import org.apache.log4j.Logger;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import org.w3c.dom.Document;
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
17 import org.w3c.dom.Element;
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
18 import org.w3c.dom.Node;
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
19 import org.w3c.dom.NodeList;
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import de.intevation.artifacts.ArtifactFactory;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import de.intevation.artifacts.CallContext;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 import de.intevation.artifacts.common.ArtifactNamespaceContext;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 import de.intevation.artifacts.common.utils.XMLUtils;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 import de.intevation.artifactdatabase.DefaultArtifact;
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
28 import de.intevation.artifactdatabase.data.DefaultStateData;
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 import de.intevation.artifactdatabase.data.StateData;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 import de.intevation.artifactdatabase.state.State;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 import de.intevation.artifactdatabase.state.StateEngine;
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
32 import de.intevation.artifactdatabase.transition.TransitionEngine;
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
34 import de.intevation.flys.model.Gauge;
402
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
35 import de.intevation.flys.model.Range;
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
36 import de.intevation.flys.model.River;
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
37
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 import de.intevation.flys.artifacts.context.FLYSContext;
377
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
39 import de.intevation.flys.artifacts.model.DischargeTables;
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
40 import de.intevation.flys.artifacts.model.RiverFactory;
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 321
diff changeset
41 import de.intevation.flys.artifacts.states.DefaultState;
628
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
42 import de.intevation.flys.artifacts.states.LocationDistanceSelect;
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 * The defaul FLYS artifact.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 public abstract class FLYSArtifact extends DefaultArtifact {
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 /** The logger that is used in this artifact.*/
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 private static Logger logger = Logger.getLogger(FLYSArtifact.class);
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
56 /** The XPath that points to the input data elements of the FEED document.*/
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
57 public static final String XPATH_FEED_INPUT =
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
58 "/art:action/art:data/art:input";
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
60 /** The XPath that points to the name of the target state of ADVANCE.*/
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
61 public static final String XPATH_ADVANCE_TARGET =
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
62 "/art:action/art:target/@art:name";
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
63
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
64 /** The constant string that shows that an operation was successful.*/
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
65 public static final String OPERATION_SUCCESSFUL = "SUCCESS";
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
66
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
67 /** The constant string that shows that an operation failed.*/
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
68 public static final String OPERATION_FAILED = "FAILURE";
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
69
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
70 /** The default number of steps between the start end end of a selected Q
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
71 * range.*/
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
72 public static final int DEFAULT_Q_STEPS = 30;
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
73
398
435058da0eae Use a default step width (100m) between two kilometers if no width is given.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 383
diff changeset
74 /** The default step width between the start end end kilometer.*/
435058da0eae Use a default step width (100m) between two kilometers if no width is given.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 383
diff changeset
75 public static final double DEFAULT_KM_STEPS = 0.1;
435058da0eae Use a default step width (100m) between two kilometers if no width is given.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 383
diff changeset
76
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 /** The identifier of the current state. */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 protected String currentStateId;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
81 /** The identifiers of previous states on a stack.*/
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
82 protected Vector<String> previousStateIds;
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
83
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 /** The name of the artifact.*/
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 protected String name;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
87 /** The data that have been inserted into this artifact.*/
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
88 protected Map<String, StateData> data;
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
89
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
90
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
91 /**
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
92 * The default constructor that creates an empty FLYSArtifact.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
93 */
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
94 public FLYSArtifact() {
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
95 data = new HashMap<String, StateData>();
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
96 previousStateIds = new Vector<String>();
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
97 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
98
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
99
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
100 /**
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
101 * Returns the name of the concrete artifact.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
102 *
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
103 * @return the name of the concrete artifact.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
104 */
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
105 public abstract String getName();
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
106
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
107
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
108 /**
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
109 * Returns the FLYSContext from context object.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
110 *
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
111 * @param context The CallContext or the FLYSContext.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
112 *
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
113 * @return the FLYSContext.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
114 */
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
115 protected FLYSContext getFlysContext(Object context) {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
116 return context instanceof FLYSContext
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
117 ? (FLYSContext) context
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
118 : (FLYSContext) ((CallContext) context).globalContext();
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
119 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
120
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 * Initialize the artifact and insert new data if <code>data</code> contains
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 * information necessary for this artifact.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 * @param identifier The UUID.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 * @param factory The factory that is used to create this artifact.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 * @param context The CallContext.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 * @param data Some optional data.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 @Override
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 public void setup(
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 String identifier,
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 ArtifactFactory factory,
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 Object context,
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 Document data)
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 {
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 logger.debug("Setup this artifact with the uuid: " + identifier);
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 super.setup(identifier, factory, context, data);
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 FLYSContext flysContext = (FLYSContext) context;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 StateEngine engine = (StateEngine) flysContext.get(
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 FLYSContext.STATE_ENGINE_KEY);
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
146 String name = getName();
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
147
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
148 logger.debug("Set initial state for artifact '" + name + "'");
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 List<State> states = engine.getStates(name);
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 setCurrentState(states.get(0));
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 * Insert new data included in <code>input</code> into the current state.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 * @param target XML document that contains new data.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 * @param context The CallContext.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 * @return a document that contains a SUCCESS or FAILURE message.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 @Override
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 public Document feed(Document target, CallContext context) {
123
ebb1cb69d847 The operations feed() and advance() return the current description of the artifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 122
diff changeset
165 logger.info("FLYSArtifact.feed()");
ebb1cb69d847 The operations feed() and advance() return the current description of the artifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 122
diff changeset
166
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
167 Document doc = XMLUtils.newDocument();
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
169 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
170 doc,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
171 ArtifactNamespaceContext.NAMESPACE_URI,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
172 ArtifactNamespaceContext.NAMESPACE_PREFIX);
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
174 Element result = creator.create("result");
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
175 doc.appendChild(result);
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
177 try {
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 321
diff changeset
178 saveData(target, XPATH_FEED_INPUT, context);
123
ebb1cb69d847 The operations feed() and advance() return the current description of the artifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 122
diff changeset
179 return describe(target, context);
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
180 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
181 catch (IllegalArgumentException iae) {
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
182 creator.addAttr(result, "type", OPERATION_FAILED, true);
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
183
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
184 result.setTextContent(iae.getMessage());
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
185 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
186
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
187 return doc;
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 /**
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
192 * This method handles request for changing the current state of an
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
193 * artifact. It is possible to step forward or backward.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
194 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
195 * @param target The incoming ADVANCE document.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
196 * @param context The CallContext.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
197 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
198 * @return a document that contains a SUCCESS or FAILURE message.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
199 */
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
200 public Document advance(Document target, CallContext context) {
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
201 Document doc = XMLUtils.newDocument();
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
202
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
203 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
204 doc,
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
205 ArtifactNamespaceContext.NAMESPACE_URI,
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
206 ArtifactNamespaceContext.NAMESPACE_PREFIX);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
207
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
208 Element result = ec.create("result");
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
209
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
210 String targetState = XMLUtils.xpathString(
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
211 target, XPATH_ADVANCE_TARGET, ArtifactNamespaceContext.INSTANCE);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
212
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
213 logger.info("FLYSArtifact.advance() to '" + targetState + "'");
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
214
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
215 if (isStateReachable(targetState, context)) {
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
216 logger.info("Advance: Step forward");
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
217
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
218 Vector<String> prev = getPreviousStateIds();
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
219 prev.add(getCurrentStateId());
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
220
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
221 setCurrentStateId(targetState);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
222
123
ebb1cb69d847 The operations feed() and advance() return the current description of the artifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 122
diff changeset
223 return describe(target, context);
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
224 }
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
225 else if (isPreviousState(targetState, context)) {
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
226 logger.info("Advance: Step back to");
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
227
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
228 Vector<String> prevs = getPreviousStateIds();
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
229 int targetIdx = prevs.indexOf(targetState);
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
230 int start = prevs.size() - 1;
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
231
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
232 for (int i = start; i >= targetIdx; i--) {
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
233 String prev = prevs.get(i);
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
234 logger.debug("Remove state id '" + prev + "'");
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
235 prevs.remove(prev);
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
236 }
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
237
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
238 setCurrentStateId(targetState);
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
239
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
240 return describe(target, context);
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
241 }
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
242
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
243 logger.warn("Advance: Cannot advance to '" + targetState + "'");
123
ebb1cb69d847 The operations feed() and advance() return the current description of the artifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 122
diff changeset
244 ec.addAttr(result, "type", OPERATION_FAILED, true);
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
245
123
ebb1cb69d847 The operations feed() and advance() return the current description of the artifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 122
diff changeset
246 doc.appendChild(result);
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
247
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
248 return doc;
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
249 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
250
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
251
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
252 /**
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
253 * Returns the identifier of the current state.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
254 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
255 * @return the identifier of the current state.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
256 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
257 protected String getCurrentStateId() {
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
258 return currentStateId;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
259 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
260
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
261
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
262 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
263 * Sets the identifier of the current state.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
264 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
265 * @param id the identifier of a state.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
266 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
267 protected void setCurrentStateId(String id) {
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
268 currentStateId = id;
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
269 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
270
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
271
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
272 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
273 * Set the current state of this artifact. <b>NOTE</b>We don't store the
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
274 * State object itself - which is not necessary - but its identifier. So
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
275 * this method will just call the setCurrentStateId() method with the
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
276 * identifier of <i>state</i>.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
277 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
278 * @param state The new current state.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
279 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
280 protected void setCurrentState(State state) {
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
281 setCurrentStateId(state.getID());
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
282 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
283
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
284
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
285 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
286 * Returns the current state of the artifact.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
287 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
288 * @return the current State of the artifact.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
289 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
290 protected State getCurrentState(Object context) {
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
291 FLYSContext flysContext = getFlysContext(context);
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
292 StateEngine engine = (StateEngine) flysContext.get(
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
293 FLYSContext.STATE_ENGINE_KEY);
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
294
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
295 return engine.getState(getCurrentStateId());
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
296 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
297
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
298
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
299 /**
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
300 * Returns the vector of previous state identifiers.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
301 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
302 * @return the vector of previous state identifiers.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
303 */
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
304 protected Vector<String> getPreviousStateIds() {
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
305 return previousStateIds;
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
306 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
307
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
308
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
309 /**
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
310 * Adds a new StateData item to the data pool of this artifact.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
311 *
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
312 * @param name the name of the data object.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
313 * @param data the data object itself.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
314 */
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
315 protected void addData(String name, StateData data) {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
316 this.data.put(name, data);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
317 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
318
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
319
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
320 /**
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
321 * This method returns a specific StateData object that is stored in the
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
322 * data pool of this artifact.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
323 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
324 * @param name The name of the data object.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
325 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
326 * @return the StateData object if existing, otherwise null.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
327 */
298
fc694a43a7e5 Changed the visibility of getData() method of FLYSArtifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 140
diff changeset
328 public StateData getData(String name) {
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
329 return data.get(name);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
330 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
331
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
332
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
333 /**
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
334 * This method stores the data that is contained in the FEED document.
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
335 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
336 * @param feed The FEED document.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
337 * @param xpath The XPath that points to the data nodes.
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
338 */
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 321
diff changeset
339 public void saveData(Document feed, String xpath, CallContext context)
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
340 throws IllegalArgumentException
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
341 {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
342 if (feed == null || xpath == null || xpath.length() == 0) {
325
7a0907742cc0 Changed the error key that is written to the result document of the feed operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 322
diff changeset
343 throw new IllegalArgumentException("error_feed_no_data");
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
344 }
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
345
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
346 NodeList nodes = (NodeList) XMLUtils.xpath(
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
347 feed,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
348 xpath,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
349 XPathConstants.NODESET,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
350 ArtifactNamespaceContext.INSTANCE);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
351
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
352 if (nodes == null || nodes.getLength() == 0) {
325
7a0907742cc0 Changed the error key that is written to the result document of the feed operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 322
diff changeset
353 throw new IllegalArgumentException("error_feed_no_data");
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
354 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
355
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
356 int count = nodes.getLength();
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
357 logger.debug("Try to save " + count + " data items.");
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
358
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
359 for (int i = 0; i < count; i++) {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
360 Node node = nodes.item(i);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
361
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
362 String name = XMLUtils.xpathString(
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
363 node, "@art:name", ArtifactNamespaceContext.INSTANCE);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
364 String value = XMLUtils.xpathString(
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
365 node, "@art:value", ArtifactNamespaceContext.INSTANCE);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
366
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
367 if (name != null && value != null) {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
368 logger.debug("Save data item for '" + name + "' : " + value);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
369
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
370 addData(name, new DefaultStateData(name, null, null, value));
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
371 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
372 }
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 321
diff changeset
373
624
929137ee8154 ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
374 DefaultState current = (DefaultState) getCurrentState(context);
929137ee8154 ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
375 current.validate(this, context);
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
376 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
377
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
378
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
379 /**
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
380 * Determines if the state with the identifier <i>stateId</i> is reachable
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
381 * from the current state. The determination itself takes place in the
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
382 * TransitionEngine.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
383 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
384 * @param stateId The identifier of a state.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
385 * @param context The context object.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
386 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
387 * @return true, if the state specified by <i>stateId</i> is reacahble,
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
388 * otherwise false.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
389 */
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
390 protected boolean isStateReachable(String stateId, Object context) {
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
391 logger.debug("Determine if the state '" + stateId + "' is reachable.");
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
392
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
393 FLYSContext flysContext = getFlysContext(context);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
394
624
929137ee8154 ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
395 State currentState = getCurrentState(context);
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
396 StateEngine sEngine = (StateEngine) flysContext.get(
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
397 FLYSContext.STATE_ENGINE_KEY);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
398
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
399 TransitionEngine tEngine = (TransitionEngine) flysContext.get(
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
400 FLYSContext.TRANSITION_ENGINE_KEY);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
401
355
d97982627596 Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 325
diff changeset
402 return tEngine.isStateReachable(this, stateId, currentState, sEngine);
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
403 }
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
404
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
405
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
406 /**
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
407 * Determines if the state with the identifier <i>stateId</i> is a previous
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
408 * state of the current state.
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
409 *
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
410 * @param stateId The target state identifier.
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
411 * @param context The context object.
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
412 */
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
413 protected boolean isPreviousState(String stateId, Object context) {
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
414 logger.debug("Determine if the state '" + stateId + "' is old.");
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
415
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
416 Vector<String> prevs = getPreviousStateIds();
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
417 if (prevs.contains(stateId)) {
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
418 return true;
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
419 }
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
420
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
421 return false;
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
422 }
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
423
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
424
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
425 /**
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
426 * Returns the selected River object based on the 'river' data that might
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
427 * have been inserted by the user.
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
428 *
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
429 * @return the selected River or null if no river has been chosen yet.
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
430 */
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
431 public River getRiver() {
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
432 StateData dRiver = getData("river");
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
433
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
434 return dRiver != null
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
435 ? RiverFactory.getRiver((String) dRiver.getValue())
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
436 : null;
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
437 }
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
438
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
439
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
440 /**
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
441 * Returns the selected distance of points.
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
442 *
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
443 * @return the selected distance or points.
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
444 */
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
445 public double[] getDistance() {
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
446 StateData dFrom = getData("ld_from");
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
447 StateData dTo = getData("ld_to");
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
448 StateData dLocations = getData("ld_locations");
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
449
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
450 if (dFrom != null && dTo != null) {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
451 return getDistanceByRange(dFrom, dTo);
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
452 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
453 else if (dLocations != null) {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
454 double[] locations = getLocations();
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
455 return new double[] { locations[0], locations[locations.length-1] };
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
456 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
457
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
458 logger.warn("No data found for distance determination!");
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
459
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
460 return null;
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
461 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
462
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
463
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
464 /**
627
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
465 * Determines the selected mode of distance/range input.
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
466 *
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
467 * @return true, if the range mode is selected otherwise false.
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
468 */
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
469 public boolean isRange() {
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
470 StateData mode = getData("ld_mode");
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
471
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
472 if (mode == null) {
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
473 logger.warn("No mode location/range chosen. Defaults to range.");
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
474 return true;
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
475 }
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
476
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
477 String value = (String) mode.getValue();
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
478
628
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
479 return value.equals("distance");
627
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
480 }
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
481
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
482
833290f16f09 ISSUE-85 (part I/III) Added further fields for the location/range state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
483 /**
402
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
484 * This method returns the given distance
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
485 *
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
486 * @return an array with lower and upper kilometer range for each
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
487 * intersected gauge.
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
488 */
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
489 public double[][] getSplittedDistance() {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
490 double[] dist = getDistance();
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
491 List<Gauge> gauges = getGauges();
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
492
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
493 int num = gauges != null ? gauges.size() : 0;
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
494
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
495 double[][] res = new double[num][2];
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
496
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
497 for (int i = 0; i < num; i++) {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
498 Range range = gauges.get(i).getRange();
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
499
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
500 double lower = range.getA().doubleValue();
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
501 double upper = range.getB().doubleValue();
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
502
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
503 res[i][0] = dist[0] < lower ? lower : dist[0];
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
504 res[i][1] = dist[1] > upper ? upper : dist[1];
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
505 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
506
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
507 return res;
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
508 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
509
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
510
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
511 /**
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
512 * Returns the selected locations based on a given array of locations.
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
513 *
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
514 * @param locations The StateData that contains the locations.
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
515 *
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
516 * @return the selected locations.
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
517 */
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
518 public double[] getLocations() {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
519 StateData dLocations = getData("ld_locations");
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
520 String locationStr = dLocations != null
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
521 ? (String) dLocations.getValue()
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
522 : "";
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
523
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
524 if (locationStr == null || locationStr.length() == 0) {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
525 logger.warn("No valid location string found!");
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
526 return null;
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
527 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
528
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
529 String[] tmp = locationStr.split(" ");
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
530 TDoubleArrayList locations = new TDoubleArrayList();
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
531
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
532 for (String l: tmp) {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
533 try {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
534 locations.add(Double.parseDouble(l));
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
535 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
536 catch (NumberFormatException nfe) {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
537 logger.warn(nfe, nfe);
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
538 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
539 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
540
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
541 locations.sort();
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
542
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
543 return locations.toNativeArray();
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
544 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
545
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
546
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
547 /**
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
548 * Returns the selected distance based on a given range (from, to).
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
549 *
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
550 * @param dFrom The StateData that contains the lower value.
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
551 * @param dTo The StateData that contains the upper value.
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
552 *
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
553 * @return the selected distance.
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
554 */
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 379
diff changeset
555 protected double[] getDistanceByRange(StateData dFrom, StateData dTo) {
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
556 double from = Double.parseDouble((String) dFrom.getValue());
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
557 double to = Double.parseDouble((String) dTo.getValue());
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
558
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
559 return new double[] { from, to };
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
560 }
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
561
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
562
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
563 /**
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
564 * Returns the selected Kms.
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
565 *
402
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
566 * @param distance An 2dim array with [lower, upper] values.
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
567 *
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
568 * @return the selected Kms.
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
569 */
402
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
570 public double[] getKms(double[] distance) {
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
571 StateData dStep = getData("ld_step");
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
572
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
573 if (dStep == null) {
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
574 logger.warn("No step width given. Cannot compute Kms.");
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
575 return null;
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
576 }
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
577
402
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
578 double step = Double.parseDouble((String) dStep.getValue());
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
579
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
580 // transform step from 'm' into 'km'
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
581 step = step / 1000;
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
582
398
435058da0eae Use a default step width (100m) between two kilometers if no width is given.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 383
diff changeset
583 if (step == 0d) {
435058da0eae Use a default step width (100m) between two kilometers if no width is given.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 383
diff changeset
584 step = DEFAULT_KM_STEPS;
435058da0eae Use a default step width (100m) between two kilometers if no width is given.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 383
diff changeset
585 }
435058da0eae Use a default step width (100m) between two kilometers if no width is given.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 383
diff changeset
586
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
587 return getExplodedValues(distance[0], distance[1], step);
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
588 }
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
589
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
590
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
591 /**
402
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
592 * Returns the selected Kms.
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
593 *
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
594 * @return the selected kms.
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
595 */
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
596 public double[] getKms() {
628
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
597 if (isRange()) {
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
598 double[] distance = getDistance();
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
599 return getKms(distance);
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
600
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
601 }
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
602 else {
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
603 return LocationDistanceSelect.getLocations(this);
51b69bca4560 ISSUE-85 (part III/III) Use the given kilometer values for the waterlevel computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
604 }
402
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
605 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
606
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
607
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
608 /**
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
609 * Returns the gauge based on the current distance and river.
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
610 *
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
611 * @return the gauge.
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
612 */
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
613 public Gauge getGauge() {
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
614 River river = getRiver();
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
615 double[] dist = getDistance();
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
616
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
617 if (logger.isDebugEnabled()) {
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
618 logger.debug("Determine gauge for:");
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
619 logger.debug("... river: " + river.getName());
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
620 logger.debug("... distance: " + dist[0] + " - " + dist[1]);
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
621 }
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
622
320
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 317
diff changeset
623 Gauge gauge = river.determineGauge(dist[0], dist[1]);
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
624
320
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 317
diff changeset
625 String name = gauge != null ? gauge.getName() : "'n/a";
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 317
diff changeset
626 logger.debug("Found gauge: " + name);
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 317
diff changeset
627
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 317
diff changeset
628 return gauge;
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
629 }
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
630
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
631
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
632 /**
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
633 * Returns the gauges that match the selected kilometer range.
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
634 *
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
635 * @return the gauges based on the selected kilometer range.
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
636 */
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
637 public List<Gauge> getGauges() {
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
638 River river = getRiver();
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
639 double[] dist = getDistance();
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
640
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
641 return river.determineGauges(dist[0], dist[1]);
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
642 }
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
643
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
644
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 398
diff changeset
645 /**
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
646 * This method returns the Q values.
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
647 *
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
648 * @return the selected Q values or null, if no Q values are selected.
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
649 */
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
650 public double[] getQs() {
631
a9af60c84dca Small bugfixes in the WQ selection state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 628
diff changeset
651 StateData dMode = getData("wq_mode");
a9af60c84dca Small bugfixes in the WQ selection state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 628
diff changeset
652 StateData dSelection = getData("wq_selection");
377
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
653
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
654 String mode = dMode != null ? (String) dMode.getValue() : "";
631
a9af60c84dca Small bugfixes in the WQ selection state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 628
diff changeset
655 String sel = dSelection != null ? (String)dSelection.getValue() : null;
377
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
656
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
657 if (mode.equals("Q")) {
631
a9af60c84dca Small bugfixes in the WQ selection state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 628
diff changeset
658 if (sel != null && sel.equals("single")) {
379
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
659 return getSingleWQValues();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
660 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
661 else {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
662 return getWQTriple();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
663 }
377
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
664 }
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
665 else {
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
666 logger.warn("You try to get Qs, but W has been inserted.");
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
667 return null;
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
668 }
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
669 }
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
670
455
7137ef65c17c Reintroduced titles for the "W for unausgeglichene Abfluesse".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 451
diff changeset
671 public boolean isQ() {
7137ef65c17c Reintroduced titles for the "W for unausgeglichene Abfluesse".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 451
diff changeset
672 StateData mode = getData("wq_mode");
7137ef65c17c Reintroduced titles for the "W for unausgeglichene Abfluesse".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 451
diff changeset
673 return mode != null && mode.getValue().equals("Q");
7137ef65c17c Reintroduced titles for the "W for unausgeglichene Abfluesse".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 451
diff changeset
674 }
7137ef65c17c Reintroduced titles for the "W for unausgeglichene Abfluesse".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 451
diff changeset
675
377
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
676
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
677 /**
402
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
678 * Returns the Q values based on a specified kilometer range.
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
679 *
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
680 * @param range A 2dim array with lower and upper kilometer range.
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
681 *
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
682 * @return an array of Q values.
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
683 */
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
684 public double[] getQs(double[] range) {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
685 StateData dMode = getData("wq_mode");
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
686 StateData dValues = getData("wq_values");
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
687
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
688 String mode = dMode != null ? (String) dMode.getValue() : "";
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
689
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
690 if (mode.equals("Q")) {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
691 return getWQForDist(range);
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
692 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
693
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
694 logger.warn("You try to get Qs, but Ws has been inserted.");
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
695 return null;
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
696 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
697
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
698
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
699 /**
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
700 * Returns the W values based on a specified kilometer range.
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
701 *
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
702 * @param range A 2dim array with lower and upper kilometer range.
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
703 *
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
704 * @return an array of W values.
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
705 */
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
706 public double[] getWs(double[] range) {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
707 StateData dMode = getData("wq_mode");
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
708 StateData dValues = getData("wq_values");
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
709
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
710 String mode = dMode != null ? (String) dMode.getValue() : "";
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
711
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
712 if (mode.equals("W")) {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
713 return getWQForDist(range);
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
714 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
715
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
716 logger.warn("You try to get Ws, but Qs has been inserted.");
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
717 return null;
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
718 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
719
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
720
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
721 /**
377
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
722 * This method returns the W values.
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
723 *
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
724 * @return the selected W values or null, if no W values are selected.
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
725 */
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
726 public double[] getWs() {
379
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
727 StateData dMode = getData("wq_mode");
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
728 StateData dSingle = getData("wq_single");
377
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
729
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
730 String mode = dMode != null ? (String) dMode.getValue() : "";
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
731
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
732 if (mode.equals("W")) {
379
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
733 if (dSingle != null) {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
734 return getSingleWQValues();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
735 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
736 else {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
737 return getWQTriple();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
738 }
377
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
739 }
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
740 else {
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
741 logger.warn("You try to get Qs, but W has been inserted.");
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
742 return null;
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
743 }
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
744 }
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
745
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
746
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
747 /**
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
748 * Returns the Qs for a number of Ws. This method makes use of
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
749 * DischargeTables.getQForW().
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
750 *
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
751 * @param ws An array of W values.
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
752 *
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
753 * @return an array of Q values.
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
754 */
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
755 public double[] getQsForWs(double[] ws) {
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
756 logger.debug("FLYSArtifact.getQsForWs");
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
757
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
758 River r = getRiver();
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
759 Gauge g = getGauge();
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
760
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
761 DischargeTables dt = new DischargeTables(r.getName(), g.getName());
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
762 Map<String, double [][]> tmp = dt.getValues();
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
763
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
764 double[][] values = tmp.get(g.getName());
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
765 double[] qs = new double[ws.length];
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
766
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
767 for (int i = 0; i < ws.length; i++) {
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
768 qs[i] = dt.getQForW(values, ws[i]);
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
769 }
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
770
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
771 return qs;
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
772 }
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
773
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
774
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
775 /**
402
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
776 * This method returns the given W or Q values for a specific range
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
777 * (inserted in the WQ input panel for discharge longitudinal sections).
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
778 *
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
779 * @param dist A 2dim array with lower und upper kilometer values.
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
780 *
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
781 * @return an array of W or Q values.
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
782 */
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
783 protected double[] getWQForDist(double[] dist) {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
784 logger.debug("Search wq values for range: " + dist[0] + " - " + dist[1]);
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
785 StateData data = getData("wq_values");
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
786
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
787 if (data == null) {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
788 logger.warn("Missing wq values!");
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
789 return null;
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
790 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
791
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
792 String dataString = (String) data.getValue();
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
793 String[] ranges = dataString.split(":");
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
794
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
795 for (String range: ranges) {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
796 String[] parts = range.split(";");
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
797
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
798 double lower = Double.parseDouble(parts[0]);
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
799 double upper = Double.parseDouble(parts[1]);
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
800
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
801 if (lower <= dist[0] && upper >= dist[1]) {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
802 String[] values = parts[2].split(",");
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
803
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
804 int num = values.length;
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
805 double[] res = new double[num];
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
806
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
807 for (int i = 0; i < num; i++) {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
808 try {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
809 res[i] = Double.parseDouble(values[i]);
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
810 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
811 catch (NumberFormatException nfe) {
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
812 logger.warn(nfe, nfe);
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
813 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
814 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
815
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
816 return res;
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
817 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
818 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
819
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
820 logger.warn("Specified range for WQ not found!");
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
821
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
822 return null;
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
823 }
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
824
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
825
eb22ffe4d74c Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
826 /**
377
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
827 * This method returns an array of inserted WQ triples that consist of from,
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
828 * to and the step width.
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
829 *
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
830 * @return an array of from, to and step width.
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
831 */
0ccf7200fc51 Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
832 protected double[] getWQTriple() {
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
833 StateData dFrom = getData("wq_from");
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
834 StateData dTo = getData("wq_to");
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
835
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
836 if (dFrom == null || dTo == null) {
379
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
837 logger.warn("Missing start or end value for range.");
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
838 return null;
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
839 }
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
840
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
841 double from = Double.parseDouble((String) dFrom.getValue());
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
842 double to = Double.parseDouble((String) dTo.getValue());
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
843
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
844 StateData dStep = getData("wq_step");
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
845
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
846 if (dStep == null) {
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
847 logger.warn("No step width given. Cannot compute Qs.");
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
848 return null;
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
849 }
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
850
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
851 double step = Double.parseDouble((String) dStep.getValue());
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
852
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
853 // if no width is given, the DEFAULT_Q_STEPS is used to compute the step
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
854 // width. Maybe, we should round the value to a number of digits.
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
855 if (step == 0d) {
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
856 double diff = to - from;
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
857 step = diff / DEFAULT_Q_STEPS;
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
858 }
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
859
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
860 return getExplodedValues(from, to, step);
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
861 }
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
862
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
863
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
864 /**
379
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
865 * Returns an array of inserted WQ double values stored as whitespace
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
866 * separated list.
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
867 *
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
868 * @return an array of W or Q values.
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
869 */
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
870 protected double[] getSingleWQValues() {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
871 StateData dSingle = getData("wq_single");
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
872
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
873 if (dSingle == null) {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
874 logger.warn("Cannot determine single WQ values. No data given.");
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
875 return null;
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
876 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
877
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
878 String tmp = (String) dSingle.getValue();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
879 String[] strValues = tmp.split(" ");
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
880
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
881 TDoubleArrayList values = new TDoubleArrayList();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
882
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
883 for (String strValue: strValues) {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
884 try {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
885 values.add(Double.parseDouble(strValue));
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
886 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
887 catch (NumberFormatException nfe) {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
888 logger.warn(nfe, nfe);
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
889 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
890 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
891
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
892 values.sort();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
893
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
894 return values.toNativeArray();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
895 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
896
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
897
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 377
diff changeset
898 /**
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
899 * Returns an array of double values. The values contained in this array
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
900 * begin with the value <i>from</i> and end with the value <i>to</i>. The
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
901 * number of values in the result array depends on the <i>step</i> width.
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
902 *
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
903 * @param from The lower value.
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
904 * @param to The upper value.
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
905 * @param step The step width between two values in the result array.
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
906 *
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
907 * @return an array of double values.
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
908 */
451
73bc64c4a7b0 Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 411
diff changeset
909 public static double[] getExplodedValues(double from, double to, double step) {
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
910 double lower = from;
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
911
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
912 double diff = to - from;
368
3e66a5705c39 Improved the calculation of the step width of ranges.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 362
diff changeset
913 double tmp = diff / step;
459
fadf797bf123 Increment kms array size by one to take the end of range, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 455
diff changeset
914 int num = (int)Math.abs(Math.ceil(tmp)) + 1;
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
915
459
fadf797bf123 Increment kms array size by one to take the end of range, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 455
diff changeset
916 double [] values = new double[num];
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
917
368
3e66a5705c39 Improved the calculation of the step width of ranges.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 362
diff changeset
918 for (int idx = 0; idx < num; idx++) {
3e66a5705c39 Improved the calculation of the step width of ranges.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 362
diff changeset
919 values[idx] = lower;
3e66a5705c39 Improved the calculation of the step width of ranges.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 362
diff changeset
920 lower += step;
362
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
921 }
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
922
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
923 return values;
d79a51fc4f1d Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 355
diff changeset
924 }
623
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
925
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
926
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
927 /**
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
928 * Method to dump the artifacts state/data.
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
929 */
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
930 protected void dumpArtifact() {
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
931 if (logger.isDebugEnabled()) {
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
932 logger.debug("++++++++++++++ DUMP ARTIFACT DATA +++++++++++++++++");
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
933
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
934 logger.debug("------ DUMP DATA ------");
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
935 Collection<StateData> allData = data.values();
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
936
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
937 for (StateData d: allData) {
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
938 String name = d.getName();
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
939 String value = (String) d.getValue();
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
940
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
941 logger.debug("- " + name + ": " + value);
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
942 }
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
943
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
944 logger.debug("------ DUMP PREVIOUS STATES ------");
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
945 Vector<String> stateIds = getPreviousStateIds();
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
946
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
947 for (String id: stateIds) {
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
948 logger.debug("- State: " + id);
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
949 }
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
950
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
951 logger.debug("CURRENT STATE: " + getCurrentStateId());
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
952
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
953 logger.debug("++++++++++++++ END ARTIFACT DUMP +++++++++++++++++");
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
954 }
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
955 }
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
956 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
957 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org