Mercurial > dive4elements > river
changeset 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 | 8735d1a9af4c |
children | d9e4b7e8905a |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java |
diffstat | 2 files changed, 55 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Tue Mar 22 16:09:30 2011 +0000 +++ b/flys-artifacts/ChangeLog Wed Mar 23 10:52:01 2011 +0000 @@ -1,3 +1,12 @@ +2011-03-23 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: Added + some code to append the output modes of previous states to the DESCRIBE + document. + + TODO: Determine if the current state is already filled with data and + append its output modes as well! + 2011-03-22 Ingo Weinzierl <ingo@intevation.de> * doc/conf/artifacts/winfo.xml: Enhanced the location_distance state with
--- 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.