Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Tue Mar 22 16:09:30 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Wed Mar 23 10:52:01 2011 +0000 @@ -13,6 +13,7 @@ import de.intevation.artifacts.CallContext; import de.intevation.artifactdatabase.ProtocolUtils; +import de.intevation.artifactdatabase.state.Output; import de.intevation.artifactdatabase.state.State; import de.intevation.artifactdatabase.state.StateEngine; import de.intevation.artifactdatabase.transition.TransitionEngine; @@ -97,6 +98,10 @@ Element staticUI = ProtocolUtils.createArtNode( creator, "static", null, null); + Element outs = ProtocolUtils.createArtNode( + creator, "outputmodes", null, null); + appendOutputModes(description, outs, context, identifier()); + appendStaticUI(description, staticUI, context, identifier()); Element dynamic = current.describe( @@ -105,9 +110,14 @@ context, identifier()); - ui.appendChild(dynamic); + if (dynamic != null) { + ui.appendChild(dynamic); + } + ui.appendChild(staticUI); + root.appendChild(ui); + root.appendChild(outs); return description; } @@ -123,6 +133,41 @@ } + protected void appendOutputModes( + Document doc, + Element outs, + CallContext context, + String uuid) + { + Vector<String> stateIds = getPreviousStateIds(); + + XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( + doc, + ArtifactNamespaceContext.NAMESPACE_URI, + ArtifactNamespaceContext.NAMESPACE_PREFIX); + + FLYSContext flysContext = getFlysContext(context); + StateEngine engine = (StateEngine) flysContext.get( + FLYSContext.STATE_ENGINE_KEY); + + for (String stateId: stateIds) { + logger.debug("Append output modes for state: " + stateId); + State state = engine.getState(stateId); + + List<Output> list = state.getOutputs(); + if (list == null || list.size() == 0) { + continue; + } + + ProtocolUtils.appendOutputModes(creator, outs, list); + } + + // TODO If the current state is already filled with data, the output is + // available as well! So we need some code to append the outputs of the + // current already filled state. + } + + /** * This method appends the static data - that has already been inserted by * the user - to the static node of the DESCRIBE document.