changeset 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 542f280d72c3
children 22e9574c8b1b
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java
diffstat 3 files changed, 26 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Apr 28 11:16:21 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu Apr 28 11:20:11 2011 +0000
@@ -1,3 +1,12 @@
+2011-04-28  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: Bugfixes:
+	  - Adapted the parameters of the isStateReachable() call - added the
+	    artifact and the current state.
+	  - Append the outputs of a current state if the state is filled with
+	    valid data.
+
 2011-04-28  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/transitions/DefaultTransition.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Thu Apr 28 11:16:21 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Thu Apr 28 11:20:11 2011 +0000
@@ -419,7 +419,7 @@
         TransitionEngine tEngine = (TransitionEngine) flysContext.get(
             FLYSContext.TRANSITION_ENGINE_KEY);
 
-        return tEngine.isStateReachable(stateId, currentState, sEngine);
+        return tEngine.isStateReachable(this, stateId, currentState, sEngine);
     }
 
 
--- 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