Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 2606:619f6dfec901
#460 Fixed duplicated Outputs in DESCRIBE documents.
flys-artifacts/trunk@4186 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 30 Mar 2012 09:38:29 +0000 |
parents | 3f1cc396d253 |
children | 247f3e98a14b |
comparison
equal
deleted
inserted
replaced
2605:15a3684c6bce | 2606:619f6dfec901 |
---|---|
240 Document doc, | 240 Document doc, |
241 Element outs, | 241 Element outs, |
242 CallContext context, | 242 CallContext context, |
243 String uuid) | 243 String uuid) |
244 { | 244 { |
245 List<String> stateIds = getPreviousStateIds(); | 245 List<Output> generated = getOutputs(context); |
246 | 246 logger.debug("This Artifact has " + generated.size() + " Outputs."); |
247 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( | 247 |
248 doc, | 248 ProtocolUtils.appendOutputModes(doc, outs, generated); |
249 ArtifactNamespaceContext.NAMESPACE_URI, | |
250 ArtifactNamespaceContext.NAMESPACE_PREFIX); | |
251 | |
252 FLYSContext flysContext = FLYSUtils.getFlysContext(context); | |
253 StateEngine engine = (StateEngine) flysContext.get( | |
254 FLYSContext.STATE_ENGINE_KEY); | |
255 | |
256 for (String stateId: stateIds) { | |
257 logger.debug("Append output modes for state: " + stateId); | |
258 DefaultState state = (DefaultState) engine.getState(stateId); | |
259 | |
260 List<Output> list = state.getOutputs(); | |
261 if (list == null || list.size() == 0) { | |
262 logger.debug("-> No output modes for this state."); | |
263 continue; | |
264 } | |
265 | |
266 List<Facet> fs = facets.get(stateId); | |
267 | |
268 if (fs == null || fs.size() == 0) { | |
269 logger.debug("No facets for previous state found."); | |
270 continue; | |
271 } | |
272 | |
273 logger.debug("Found " + fs.size() + " facets in previous states."); | |
274 | |
275 List<Output> generated = generateOutputs(list, fs); | |
276 | |
277 ProtocolUtils.appendOutputModes(doc, outs, generated); | |
278 } | |
279 | |
280 try { | |
281 DefaultState cur = (DefaultState) getCurrentState(context); | |
282 if (cur.validate(this)) { | |
283 List<Output> list = cur.getOutputs(); | |
284 if (list != null && list.size() > 0) { | |
285 logger.debug( | |
286 "Append output modes for current state: " + cur.getID()); | |
287 | |
288 List<Facet> fs = facets.get(cur.getID()); | |
289 | |
290 if (fs != null && fs.size() > 0) { | |
291 List<Output> generated = generateOutputs(list, fs); | |
292 | |
293 logger.debug("Found " + fs.size() + " current facets."); | |
294 if (!generated.isEmpty()) { | |
295 ProtocolUtils.appendOutputModes( | |
296 doc, outs, generated); | |
297 } | |
298 } | |
299 else { | |
300 logger.debug("No facets found for the current state."); | |
301 } | |
302 } | |
303 } | |
304 } | |
305 catch (IllegalArgumentException iae) { | |
306 // state is not valid, so we do not append its outputs. | |
307 } | |
308 } | 249 } |
309 | 250 |
310 | 251 |
311 /** | 252 /** |
312 * This method appends the static data - that has already been inserted by | 253 * This method appends the static data - that has already been inserted by |