comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 144:dde6904ba160

The DESCRIBE of the WINFO artifact contains the available output modes now. flys-artifacts/trunk@1544 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 23 Mar 2011 10:52:01 +0000
parents f3dfa188d8b2
children c97f9bc9b642
comparison
equal deleted inserted replaced
143:8735d1a9af4c 144:dde6904ba160
11 11
12 import de.intevation.artifacts.ArtifactNamespaceContext; 12 import de.intevation.artifacts.ArtifactNamespaceContext;
13 import de.intevation.artifacts.CallContext; 13 import de.intevation.artifacts.CallContext;
14 14
15 import de.intevation.artifactdatabase.ProtocolUtils; 15 import de.intevation.artifactdatabase.ProtocolUtils;
16 import de.intevation.artifactdatabase.state.Output;
16 import de.intevation.artifactdatabase.state.State; 17 import de.intevation.artifactdatabase.state.State;
17 import de.intevation.artifactdatabase.state.StateEngine; 18 import de.intevation.artifactdatabase.state.StateEngine;
18 import de.intevation.artifactdatabase.transition.TransitionEngine; 19 import de.intevation.artifactdatabase.transition.TransitionEngine;
19 20
20 import de.intevation.artifacts.common.utils.XMLUtils; 21 import de.intevation.artifacts.common.utils.XMLUtils;
95 creator, "ui", null, null); 96 creator, "ui", null, null);
96 97
97 Element staticUI = ProtocolUtils.createArtNode( 98 Element staticUI = ProtocolUtils.createArtNode(
98 creator, "static", null, null); 99 creator, "static", null, null);
99 100
101 Element outs = ProtocolUtils.createArtNode(
102 creator, "outputmodes", null, null);
103 appendOutputModes(description, outs, context, identifier());
104
100 appendStaticUI(description, staticUI, context, identifier()); 105 appendStaticUI(description, staticUI, context, identifier());
101 106
102 Element dynamic = current.describe( 107 Element dynamic = current.describe(
103 description, 108 description,
104 root, 109 root,
105 context, 110 context,
106 identifier()); 111 identifier());
107 112
108 ui.appendChild(dynamic); 113 if (dynamic != null) {
114 ui.appendChild(dynamic);
115 }
116
109 ui.appendChild(staticUI); 117 ui.appendChild(staticUI);
118
110 root.appendChild(ui); 119 root.appendChild(ui);
120 root.appendChild(outs);
111 121
112 return description; 122 return description;
113 } 123 }
114 124
115 125
118 * 128 *
119 * @return the name of the concrete artifact. 129 * @return the name of the concrete artifact.
120 */ 130 */
121 public String getName() { 131 public String getName() {
122 return ARTIFACT_NAME; 132 return ARTIFACT_NAME;
133 }
134
135
136 protected void appendOutputModes(
137 Document doc,
138 Element outs,
139 CallContext context,
140 String uuid)
141 {
142 Vector<String> stateIds = getPreviousStateIds();
143
144 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
145 doc,
146 ArtifactNamespaceContext.NAMESPACE_URI,
147 ArtifactNamespaceContext.NAMESPACE_PREFIX);
148
149 FLYSContext flysContext = getFlysContext(context);
150 StateEngine engine = (StateEngine) flysContext.get(
151 FLYSContext.STATE_ENGINE_KEY);
152
153 for (String stateId: stateIds) {
154 logger.debug("Append output modes for state: " + stateId);
155 State state = engine.getState(stateId);
156
157 List<Output> list = state.getOutputs();
158 if (list == null || list.size() == 0) {
159 continue;
160 }
161
162 ProtocolUtils.appendOutputModes(creator, outs, list);
163 }
164
165 // TODO If the current state is already filled with data, the output is
166 // available as well! So we need some code to append the outputs of the
167 // current already filled state.
123 } 168 }
124 169
125 170
126 /** 171 /**
127 * This method appends the static data - that has already been inserted by 172 * This method appends the static data - that has already been inserted by

http://dive4elements.wald.intevation.org