changeset 354:542f280d72c3

Bugfix: Added the missing init() method to a Transition and call it in the TransitionFactory after a Transition has been created. flys-artifacts/trunk@1761 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 28 Apr 2011 11:16:21 +0000
parents 8378683fa07a
children d97982627596
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/transitions/DefaultTransition.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/transitions/TransitionFactory.java
diffstat 3 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Apr 28 11:13:06 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu Apr 28 11:16:21 2011 +0000
@@ -1,3 +1,12 @@
+2011-04-28  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/transitions/DefaultTransition.java:
+	  Added the missing init() method that has been introduced in the
+	  interface some commits ealier.
+
+	* src/main/java/de/intevation/flys/artifacts/transitions/TransitionFactory.java:
+	  Call init() after a Transition has been created.
+
 2011-04-28  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/collections/AttributeWriter.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/transitions/DefaultTransition.java	Thu Apr 28 11:13:06 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/transitions/DefaultTransition.java	Thu Apr 28 11:16:21 2011 +0000
@@ -1,8 +1,13 @@
 package de.intevation.flys.artifacts.transitions;
 
+import org.w3c.dom.Node;
+
+import de.intevation.artifacts.Artifact;
+
 import de.intevation.artifactdatabase.state.State;
 import de.intevation.artifactdatabase.transition.Transition;
 
+
 /**
  * The default implementation of a <code>Transition</code>.
  *
@@ -36,6 +41,11 @@
     }
 
 
+    public void init(Node config) {
+        // nothing to do in the default transition
+    }
+
+
     /**
      * Returns the current state ID.
      *
@@ -77,13 +87,17 @@
 
 
     /**
-     * This method always returns <i>true</i>.
+     * Determines if its valid to step from state <i>a</i> of an artifact
+     * <i>artifact</i> to state <i>b</i>. This method always returns true - no
+     * validation takes place.
      *
-     * @param state The target state.
+     * @param artifact The owner artifact of state a and b.
+     * @param a The current state.
+     * @param b The target state.
      *
-     * @return true.
+     * @return true, if it is valid to step from a to b, otherwise false.
      */
-    public boolean isValid(State state) {
+    public boolean isValid(Artifact artifact, State a, State b) {
         return true;
     }
 }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/transitions/TransitionFactory.java	Thu Apr 28 11:13:06 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/transitions/TransitionFactory.java	Thu Apr 28 11:16:21 2011 +0000
@@ -51,6 +51,7 @@
             String to = (String) XMLUtils.xpath(
                 transitionConf, XPATH_TARGET_STATE, XPathConstants.STRING);
 
+            transition.init(transitionConf);
             transition.setFrom(from);
             transition.setTo(to);
         }

http://dive4elements.wald.intevation.org