Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/MapArtifact.java @ 2414:b5f5af53a526
Make it compileable again
flys-artifacts/trunk@4045 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 13 Feb 2012 17:48:14 +0000 |
parents | 60e3bf470c5b |
children | 4bd3d8bbb60c |
rev | line source |
---|---|
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 import java.util.List; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Document; |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
8 import org.w3c.dom.Element; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
9 import org.w3c.dom.Node; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.ArtifactFactory; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifacts.CallMeta; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.CallContext; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
15 import de.intevation.artifacts.common.utils.XMLUtils; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
16 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
17 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
18 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
19 import de.intevation.artifactdatabase.ProtocolUtils; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifactdatabase.state.Facet; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifactdatabase.state.State; |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
22 import de.intevation.artifactdatabase.state.StateEngine; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
23 import de.intevation.artifactdatabase.state.Output; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
24 import de.intevation.artifactdatabase.transition.TransitionEngine; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.flys.model.River; |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
27 import de.intevation.flys.utils.FLYSUtils; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
29 import de.intevation.flys.artifacts.RiverAxisArtifact.RiverAxisState; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
30 import de.intevation.flys.artifacts.states.DefaultState; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
31 import de.intevation.flys.artifacts.context.FLYSContext; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
32 import de.intevation.flys.artifacts.model.WMSDBLayerFacet; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
35 public class MapArtifact extends FLYSArtifact { |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 private static final Logger logger = |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 Logger.getLogger(MapArtifact.class); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 @Override |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 public void setup( |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 String identifier, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 ArtifactFactory factory, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 Object context, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 CallMeta callmeta, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 Document data) |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 logger.debug("MapArtifact.setup"); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 this.identifier = identifier; |
2109
60e3bf470c5b
Changed the MapArtifact name to 'new_map'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2089
diff
changeset
|
50 name = "new_map"; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
52 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
54 List<State> states = getStates(context); |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
56 setCurrentState(states.get(0)); |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 @Override |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
61 public Document describe(Document data, CallContext context) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
62 logger.debug("Describe: the current state is: " + getCurrentStateId()); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
63 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
64 if (logger.isDebugEnabled()) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
65 dumpArtifact(); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
66 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
67 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
68 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
69 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
70 StateEngine stateEngine = (StateEngine) flysContext.get( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
71 FLYSContext.STATE_ENGINE_KEY); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
72 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
73 TransitionEngine transitionEngine = (TransitionEngine) flysContext.get( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
74 FLYSContext.TRANSITION_ENGINE_KEY); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
75 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
76 List<State> reachable = transitionEngine.getReachableStates( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
77 this, getCurrentState(context), stateEngine); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
78 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
79 Document description = XMLUtils.newDocument(); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
80 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
81 description, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
82 ArtifactNamespaceContext.NAMESPACE_URI, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
83 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
84 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
85 Element root = ProtocolUtils.createRootNode(creator); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
86 description.appendChild(root); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
87 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
88 State current = getCurrentState(context); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
89 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
90 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash()); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
91 ProtocolUtils.appendState(creator, root, current); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
92 ProtocolUtils.appendReachableStates(creator, root, reachable); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
93 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
94 appendBackgroundActivity(creator, root, context); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
95 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
96 Element name = ProtocolUtils.createArtNode( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
97 creator, "name", |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
98 new String[] { "value" }, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
99 new String[] { getName() }); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
100 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
101 Element ui = ProtocolUtils.createArtNode( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
102 creator, "ui", null, null); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
103 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
104 Element staticUI = ProtocolUtils.createArtNode( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
105 creator, "static", null, null); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
106 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
107 Element outs = ProtocolUtils.createArtNode( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
108 creator, "outputmodes", null, null); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
109 appendOutputModes(description, outs, context, identifier()); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
110 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
111 appendStaticUI(description, staticUI, context, identifier()); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
112 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
113 Element dynamic = current.describe( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
114 this, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
115 description, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
116 root, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
117 context, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
118 identifier()); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
119 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
120 if (dynamic != null) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
121 ui.appendChild(dynamic); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
122 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
123 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
124 ui.appendChild(staticUI); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
125 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
126 root.appendChild(name); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
127 root.appendChild(ui); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
128 root.appendChild(outs); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
129 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
130 return description; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
131 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
132 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
133 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
134 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
135 protected static void appendBackgroundActivity( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
136 ElementCreator cr, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
137 Element root, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
138 CallContext context |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
139 ) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
140 Element inBackground = cr.create("background-processing"); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
141 root.appendChild(inBackground); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
142 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
143 cr.addAttr( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
144 inBackground, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
145 "value", |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
146 String.valueOf(context.isInBackground()), |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
147 true); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
148 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
149 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
150 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
151 /** |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
152 * Append output mode nodes to a document. |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
153 */ |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
154 protected void appendOutputModes( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
155 Document doc, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
156 Element outs, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
157 CallContext context, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
158 String uuid) |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
159 { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
160 List<String> stateIds = getPreviousStateIds(); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
161 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
162 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
163 doc, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
164 ArtifactNamespaceContext.NAMESPACE_URI, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
165 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
166 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
167 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
168 StateEngine engine = (StateEngine) flysContext.get( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
169 FLYSContext.STATE_ENGINE_KEY); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
170 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
171 for (String stateId: stateIds) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
172 logger.debug("Append output modes for state: " + stateId); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
173 DefaultState state = (DefaultState) engine.getState(stateId); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
174 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
175 List<Output> list = state.getOutputs(); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
176 if (list == null || list.size() == 0) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
177 logger.debug("-> No output modes for this state."); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
178 continue; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
179 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
180 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
181 List<Facet> fs = facets.get(stateId); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
182 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
183 if (fs == null || fs.size() == 0) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
184 logger.debug("No facets for previous state found."); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
185 continue; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
186 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
187 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
188 logger.debug("Found " + fs.size() + " facets in previous states."); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
189 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
190 List<Output> generated = generateOutputs(list, fs); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
191 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
192 ProtocolUtils.appendOutputModes(doc, outs, generated); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
193 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
194 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
195 try { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
196 DefaultState cur = (DefaultState) getCurrentState(context); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
197 if (cur.validate(this)) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
198 List<Output> list = cur.getOutputs(); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
199 if (list != null && list.size() > 0) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
200 logger.debug( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
201 "Append output modes for current state: " + cur.getID()); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
202 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
203 List<Facet> fs = facets.get(cur.getID()); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
204 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
205 if (fs != null && fs.size() > 0) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
206 List<Output> generated = generateOutputs(list, fs); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
207 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
208 logger.debug("Found " + fs.size() + " current facets."); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
209 if (!generated.isEmpty()) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
210 ProtocolUtils.appendOutputModes( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
211 doc, outs, generated); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
212 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
213 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
214 else { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
215 logger.debug("No facets found for the current state."); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
216 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
217 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
218 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
219 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
220 catch (IllegalArgumentException iae) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
221 // state is not valid, so we do not append its outputs. |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
222 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
223 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
224 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
225 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
226 /** |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
227 * This method appends the static data - that has already been inserted by |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
228 * the user - to the static node of the DESCRIBE document. |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
229 * |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
230 * @param doc The document. |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
231 * @param ui The root node. |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
232 * @param context The CallContext. |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
233 * @param uuid The identifier of the artifact. |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
234 */ |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
235 protected void appendStaticUI( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
236 Document doc, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
237 Node ui, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
238 CallContext context, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
239 String uuid) |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
240 { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
241 List<String> stateIds = getPreviousStateIds(); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
242 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
243 logger.debug("previous states: " + stateIds); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
244 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
245 StateEngine engine = (StateEngine) flysContext.get( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
246 FLYSContext.STATE_ENGINE_KEY); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
247 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
248 for (String stateId: stateIds) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
249 logger.debug("Append static data for state: " + stateId); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
250 DefaultState state = (DefaultState) engine.getState(stateId); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
251 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
252 ui.appendChild(state.describeStatic(this, doc, ui, context, uuid)); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
253 } |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
254 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
255 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
256 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
257 public static class MapState extends RiverAxisState { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
258 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
259 @Override |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
260 public Object computeAdvance( |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
261 FLYSArtifact artifact, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
262 String hash, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
263 CallContext context, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
264 List<Facet> facets, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
265 Object old) |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
266 { |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
267 logger.debug("MapState.computeAdvance"); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
268 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
269 this.artifact = artifact; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
270 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
271 String type = getFacetType(); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
272 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
273 WMSDBLayerFacet facet = new WMSDBLayerFacet( |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
274 0, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
275 type, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
276 getTitle(context.getMeta()), |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
277 ComputeType.ADVANCE, |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
278 getID(), hash, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
279 getUrl()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
280 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
281 String name = type + "-" + artifact.identifier(); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
282 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
283 facet.addLayer(name); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
284 facet.setExtent(getExtent()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
285 facet.setSrid(getSrid()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
286 facet.setData(getDataString()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
287 facet.setFilter(getFilter()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
288 facet.setGeometryType(getGeometryType()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
289 facet.setConnection(getConnection()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
290 facet.setConnectionType(getConnectionType()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
291 facet.setLabelItem(getLabelItem()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
292 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
293 facets.add(facet); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
294 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
295 return null; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
296 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
297 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
298 @Override |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
299 public int getRiverId() { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
300 River r = FLYSUtils.getRiver(artifact); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
301 int riverId = r.getId(); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
302 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
303 return riverId; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
304 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
305 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
306 } |