Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifact.java @ 2681:b94b367d8b4d
Minor refactoring, docs.
flys-artifacts/trunk@4379 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 10 May 2012 09:44:31 +0000 |
parents | 9e9eb9d97548 |
children | 0ca00d547f35 |
rev | line source |
---|---|
2651
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 import org.apache.log4j.Logger; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Element; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Document; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 import org.w3c.dom.Node; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.CallContext; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifacts.common.utils.XMLUtils; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifactdatabase.ProtocolUtils; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifactdatabase.data.StateData; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifactdatabase.state.State; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifactdatabase.state.StateEngine; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifactdatabase.state.Output; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifactdatabase.transition.TransitionEngine; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.flys.artifacts.model.FacetTypes; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.flys.artifacts.context.FLYSContext; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.artifacts.states.DefaultState; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.flys.utils.FLYSUtils; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 /** |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 * The default fixation analysis artifact. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 * |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 */ |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 public class FixationArtifact |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 extends FLYSArtifact |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 implements FacetTypes { |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 /** The logger for this class. */ |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 private static Logger logger = Logger.getLogger(FixationArtifact.class); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 /** The name of the artifact. */ |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 public static final String ARTIFACT_NAME = "fixanalysis"; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 /** |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 * The default constructor. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 */ |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 public FixationArtifact() { |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 } |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 /** |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 * Returns the name of the concrete artifact. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 * |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 * @return the name of the concrete artifact. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 */ |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 public String getName() { |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 return ARTIFACT_NAME; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 } |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 public Document describe(Document data, CallContext context) { |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 logger.debug("Describe: the current state is: " + getCurrentStateId()); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 if (logger.isDebugEnabled()) { |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 dumpArtifact(); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 } |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 StateEngine stateEngine = (StateEngine) flysContext.get( |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 FLYSContext.STATE_ENGINE_KEY); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 TransitionEngine transitionEngine = (TransitionEngine) flysContext.get( |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 FLYSContext.TRANSITION_ENGINE_KEY); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 List<State> reachable = transitionEngine.getReachableStates( |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 this, getCurrentState(context), stateEngine); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 Document description = XMLUtils.newDocument(); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 description, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 ArtifactNamespaceContext.NAMESPACE_URI, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 Element root = ProtocolUtils.createRootNode(creator); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 description.appendChild(root); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 State current = getCurrentState(context); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash()); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 ProtocolUtils.appendState(creator, root, current); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 ProtocolUtils.appendReachableStates(creator, root, reachable); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 Element ui = ProtocolUtils.createArtNode( |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 creator, "ui", null, null); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 Element staticUI = ProtocolUtils.createArtNode( |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 creator, "static", null, null); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 Element outs = ProtocolUtils.createArtNode( |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 creator, "outputmodes", null, null); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 appendOutputModes(description, outs, context, identifier()); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 appendStaticUI(description, staticUI, context, identifier()); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 Element name = ProtocolUtils.createArtNode( |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 creator, "name", |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 new String[] { "value" }, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 new String[] { getName() }); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 Element dynamic = current.describe( |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 this, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 description, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 root, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 context, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 identifier()); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 if (dynamic != null) { |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 ui.appendChild(dynamic); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 } |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 ui.appendChild(staticUI); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
123 root.appendChild(name); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
124 root.appendChild(ui); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
125 root.appendChild(outs); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
127 return description; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 } |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
131 /** |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 * Append output mode nodes to a document. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 */ |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
134 protected void appendOutputModes( |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 Document doc, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 Element outs, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 CallContext context, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 String uuid) |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 { |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 List<Output> generated = getOutputs(context); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 logger.debug("This Artifact has " + generated.size() + " Outputs."); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 ProtocolUtils.appendOutputModes(doc, outs, generated); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 } |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 /** |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 * This method appends the static data - that has already been inserted by |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 * the user - to the static node of the DESCRIBE document. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 * |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 * @param doc The document. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 * @param ui The root node. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 * @param context The CallContext. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 * @param uuid The identifier of the artifact. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 */ |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 protected void appendStaticUI( |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 Document doc, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 Node ui, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 CallContext context, |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 String uuid) |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 { |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 List<String> stateIds = getPreviousStateIds(); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 StateEngine engine = (StateEngine) flysContext.get( |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 FLYSContext.STATE_ENGINE_KEY); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 for (String stateId: stateIds) { |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 logger.debug("Append static data for state: " + stateId); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 DefaultState state = (DefaultState) engine.getState(stateId); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 ui.appendChild(state.describeStatic(this, doc, ui, context, uuid)); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 } |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 } |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 } |