# HG changeset patch # User Ingo Weinzierl # Date 1300877521 0 # Node ID dde6904ba16050617183042bef5fd50e94dc6df7 # Parent 8735d1a9af4c771fec1d923b19e8f29b71d3d479 The DESCRIBE of the WINFO artifact contains the available output modes now. flys-artifacts/trunk@1544 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 8735d1a9af4c -r dde6904ba160 flys-artifacts/ChangeLog --- 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 + + * 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 * doc/conf/artifacts/winfo.xml: Enhanced the location_distance state with diff -r 8735d1a9af4c -r dde6904ba160 flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java --- 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 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 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.