annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 322:448d0dc64357

The inserted ranges (distance and WQ ranges) are validated in the feed() operation. flys-artifacts/trunk@1716 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 18 Apr 2011 12:36:08 +0000
parents 9581b88f2920
children 7a0907742cc0
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
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
3 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
4 import java.util.List;
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
5 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
6 import java.util.Set;
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
7 import java.util.Vector;
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
8
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
9 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
10
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 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
12
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.w3c.dom.Document;
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
14 import org.w3c.dom.Element;
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
15 import org.w3c.dom.Node;
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
16 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
17
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 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
19 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
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.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
22 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
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.artifactdatabase.DefaultArtifact;
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
25 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
26 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
27 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
28 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
29 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
30
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
31 import de.intevation.flys.model.Gauge;
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
32 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
33
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 import de.intevation.flys.artifacts.context.FLYSContext;
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
35 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
36 import de.intevation.flys.artifacts.states.DefaultState;
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 * 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
41 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 * @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
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 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
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 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
47 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
48
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
50 /** 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
51 public static final String XPATH_FEED_INPUT =
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
52 "/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
53
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
54 /** 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
55 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
56 "/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
57
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
58 /** 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
59 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
60
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
61 /** 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
62 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
63
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 /** 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
66 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
67
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
68 /** 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
69 protected Vector<String> previousStateIds;
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
70
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 /** 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
72 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
73
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
74 /** The data that have been inserted into this artifact.*/
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
75 protected Map<String, StateData> data;
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
76
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
77
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
78 /**
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
79 * The default constructor that creates an empty FLYSArtifact.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
80 */
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
81 public FLYSArtifact() {
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
82 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
83 previousStateIds = new Vector<String>();
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
84 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
85
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
86
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
87 /**
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
88 * Returns the name of the concrete artifact.
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 * @return the name of the concrete artifact.
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 public abstract String getName();
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
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
95 /**
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
96 * Returns the FLYSContext from context object.
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 * @param context The CallContext or the FLYSContext.
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 * @return the FLYSContext.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
101 */
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
102 protected FLYSContext getFlysContext(Object context) {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
103 return context instanceof FLYSContext
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
104 ? (FLYSContext) context
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
105 : (FLYSContext) ((CallContext) context).globalContext();
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
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 * 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
111 * 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
112 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 * @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
114 * @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
115 * @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
116 * @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
117 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 @Override
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 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
120 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
121 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
122 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
123 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
124 {
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 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
126
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 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
128
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 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
130 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
131 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
132
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
133 String name = getName();
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
134
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
135 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
136 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
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 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
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
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 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 * 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
144 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 * @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
146 * @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
147 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 * @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
149 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 @Override
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 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
152 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
153
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
154 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
155
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
156 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
157 doc,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
158 ArtifactNamespaceContext.NAMESPACE_URI,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
159 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
160
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
161 Element result = creator.create("result");
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
162 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
163
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
164 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
165 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
166 return describe(target, context);
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
167 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
168 catch (IllegalArgumentException iae) {
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
169 creator.addAttr(result, "type", OPERATION_FAILED, true);
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
170
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
171 result.setTextContent(iae.getMessage());
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
172 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
173
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
174 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
175 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 /**
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
179 * 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
180 * 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
181 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
182 * @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
183 * @param context The CallContext.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
184 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
185 * @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
186 */
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
187 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
188 Document doc = XMLUtils.newDocument();
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
189
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
190 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
191 doc,
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
192 ArtifactNamespaceContext.NAMESPACE_URI,
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
193 ArtifactNamespaceContext.NAMESPACE_PREFIX);
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 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
196
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
197 String targetState = XMLUtils.xpathString(
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
198 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
199
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
200 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
201
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
202 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
203 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
204
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
205 Vector<String> prev = getPreviousStateIds();
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
206 prev.add(getCurrentStateId());
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 setCurrentStateId(targetState);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
209
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
210 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
211 }
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
212 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
213 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
214
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
215 Vector<String> prevs = getPreviousStateIds();
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
216 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
217 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
218
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
219 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
220 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
221 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
222 prevs.remove(prev);
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
223 }
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
224
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
225 setCurrentStateId(targetState);
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
226
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
227 return describe(target, context);
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
228 }
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
229
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
230 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
231 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
232
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
233 doc.appendChild(result);
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
234
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
235 return doc;
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
236 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
237
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
238
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
239 /**
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240 * 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
241 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
242 * @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
243 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
244 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
245 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
246 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
247
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
248
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
249 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
250 * 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
251 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252 * @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
253 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
254 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
255 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
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
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
258
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 * 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
261 * 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
262 * 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
263 * 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
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 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
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 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
268 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
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 * 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
274 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
275 * @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
276 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
277 protected State getCurrentState(Object context) {
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
278 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
279 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
280 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
281
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
282 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
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 /**
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
287 * 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
288 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
289 * @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
290 */
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
291 protected Vector<String> getPreviousStateIds() {
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
292 return previousStateIds;
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
293 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
294
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
295
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
296 /**
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
297 * 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
298 *
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
299 * @param name the name of the data object.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
300 * @param data the data object itself.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
301 */
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
302 protected void addData(String name, StateData data) {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
303 this.data.put(name, data);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
304 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
305
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
306
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
307 /**
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
308 * 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
309 * 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
310 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
311 * @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
312 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
313 * @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
314 */
298
fc694a43a7e5 Changed the visibility of getData() method of FLYSArtifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 140
diff changeset
315 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
316 return data.get(name);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
317 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
318
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
319
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
320 /**
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
321 * 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
322 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
323 * @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
324 * @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
325 */
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
326 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
327 throws IllegalArgumentException
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
328 {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
329 if (feed == null || xpath == null || xpath.length() == 0) {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
330 throw new IllegalArgumentException("feed.no.input.data");
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
331 }
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
332
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
333 NodeList nodes = (NodeList) XMLUtils.xpath(
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
334 feed,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
335 xpath,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
336 XPathConstants.NODESET,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
337 ArtifactNamespaceContext.INSTANCE);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
338
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
339 if (nodes == null || nodes.getLength() == 0) {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
340 throw new IllegalArgumentException("feed.no.input.data");
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
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
343 int count = nodes.getLength();
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
344 logger.debug("Try to save " + count + " data items.");
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
345
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
346 for (int i = 0; i < count; i++) {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
347 Node node = nodes.item(i);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
348
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
349 String name = XMLUtils.xpathString(
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
350 node, "@art:name", ArtifactNamespaceContext.INSTANCE);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
351 String value = XMLUtils.xpathString(
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
352 node, "@art:value", ArtifactNamespaceContext.INSTANCE);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
353
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
354 if (name != null && value != null) {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
355 logger.debug("Save data item for '" + name + "' : " + value);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
356
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
357 addData(name, new DefaultStateData(name, null, null, value));
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 }
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
360
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 321
diff changeset
361 State current = getCurrentState(context);
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 321
diff changeset
362 DefaultState toValidate = (DefaultState) fillState(current);
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 321
diff changeset
363
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 321
diff changeset
364 toValidate.validate(this, 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
365 }
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
366
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
367
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
368 /**
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
369 * This method fills a state object with the data that have been inserted to
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
370 * this artifact. This is necessary to use the isStateReachable() method,
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
371 * because the Transitions need to know about the inserted data.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
372 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
373 * @param state The state that needs to be filled with data.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
374 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
375 * @return the filled state.
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 protected State fillState(State state) {
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
378 Map<String, StateData> stateData = state.getData();
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
379
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
380 if (stateData == null) {
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
381 return state;
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
382 }
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
383
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
384 Set<String> keys = stateData.keySet();
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
385
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
386 for (String key: keys) {
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
387 StateData tmp = getData(key);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
388
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
389 if (tmp != null) {
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
390 StateData data = stateData.get(key);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
391 data.setValue(tmp.getValue());
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 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
394
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
395 return state;
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
396 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
397
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 /**
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
400 * 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
401 * 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
402 * TransitionEngine.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
403 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
404 * @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
405 * @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
406 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
407 * @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
408 * otherwise false.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
409 */
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
410 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
411 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
412
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
413 FLYSContext flysContext = getFlysContext(context);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
414
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
415 State currentState = fillState(getCurrentState(context));
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
416 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
417 FLYSContext.STATE_ENGINE_KEY);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
418
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
419 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
420 FLYSContext.TRANSITION_ENGINE_KEY);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
421
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
422 return tEngine.isStateReachable(stateId, currentState, sEngine);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
423 }
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
424
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
425
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
426 /**
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
427 * 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
428 * 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
429 *
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
430 * @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
431 * @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
432 */
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
433 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
434 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
435
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
436 Vector<String> prevs = getPreviousStateIds();
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
437 if (prevs.contains(stateId)) {
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
438 return true;
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
439 }
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
440
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
441 return false;
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
442 }
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
443
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 /**
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
446 * 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
447 * 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
448 *
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
449 * @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
450 */
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
451 public River getRiver() {
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
452 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
453
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
454 return dRiver != null
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
455 ? 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
456 : null;
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
457 }
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
458
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
459
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
460 /**
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
461 * 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
462 *
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
463 * @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
464 */
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
465 public double[] getDistance() {
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
466 StateData dFrom = getData("ld_from");
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
467 StateData dTo = getData("ld_to");
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
468
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
469 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
470 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
471
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
472 // TODO take point selection into account
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
473
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
474 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
475 }
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
476
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
477
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
478 /**
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
479 * 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
480 *
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
481 * @return the gauge.
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
482 */
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
483 public Gauge getGauge() {
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
484 River river = getRiver();
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
485 double[] dist = getDistance();
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
486
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
487 if (logger.isDebugEnabled()) {
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
488 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
489 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
490 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
491 }
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
492
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
493 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
494
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
495 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
496 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
497
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
498 return gauge;
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
499 }
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
500 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
501 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org