diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 355:d97982627596

Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE. flys-artifacts/trunk@1762 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 28 Apr 2011 11:20:11 +0000
parents 35301cc3b875
children d79a51fc4f1d
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Thu Apr 28 11:16:21 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Thu Apr 28 11:20:11 2011 +0000
@@ -75,7 +75,7 @@
             FLYSContext.TRANSITION_ENGINE_KEY);
 
         List<State> reachable = transitionEngine.getReachableStates(
-            getCurrentState(context), stateEngine);
+            this, getCurrentState(context), stateEngine);
 
         Document description            = XMLUtils.newDocument();
         XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
@@ -169,9 +169,21 @@
             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.
+        try {
+            DefaultState cur = (DefaultState) getCurrentState(context);
+            if (cur.validate(this, context)) {
+                List<Output> list = cur.getOutputs();
+                if (list != null && list.size() > 0) {
+                    logger.debug(
+                        "Append output modes for state: " + cur.getID());
+
+                    ProtocolUtils.appendOutputModes(creator, outs, list);
+                }
+            }
+        }
+        catch (IllegalArgumentException iae) {
+            // state is not valid, so we do not append its outputs.
+        }
     }
 
 

http://dive4elements.wald.intevation.org