changeset 111:7222d8fb53ea

Changed the way of storing transitions in the TransitionEngine. flys-artifacts/trunk@1299 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 07 Feb 2011 11:32:59 +0000
parents ff3335057f11
children 0fab16cb4d44
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java
diffstat 2 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Feb 04 16:57:08 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon Feb 07 11:32:59 2011 +0000
@@ -1,3 +1,11 @@
+2011-02-07  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java:
+	  The transitions are put into the TransitionEngine with the ID of the state
+	  - not longer with the artifact name. On this way, we are able to fetch
+	  just the transitions for a specific state, instead of all the transitions
+	  of an artifact.
+
 2011-02-04  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: Describe()
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java	Fri Feb 04 16:57:08 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java	Mon Feb 07 11:32:59 2011 +0000
@@ -90,25 +90,24 @@
             String artName = (String) XMLUtils.xpath(
                 doc, XPATH_ARTIFACT_NAME, XPathConstants.STRING);
 
-            NodeList transitionList = (NodeList) XMLUtils.xpath(
+            NodeList list = (NodeList) XMLUtils.xpath(
                 doc, XPATH_TRANSITIONS, XPathConstants.NODESET);
 
-            if (transitionList == null) {
+            if (list == null) {
                 logger.warn("The artifact has no transitions configured.");
                 continue;
             }
 
-            int trans = transitionList.getLength();
+            int trans = list.getLength();
 
             logger.info(
                 "Artifact '" + artName + "' has " + trans + " transitions.");
 
             for (int i = 0; i < trans; i++) {
-                transitions.add(TransitionFactory.createTransition(
-                    transitionList.item(i)));
+                Transition t = TransitionFactory.createTransition(list.item(i));
+                String     s = t.getFrom();
+                engine.addTransition(s, t);
             }
-
-            engine.addTransition(artName, transitions);
         }
 
         context.put(FLYSContext.TRANSITION_ENGINE_KEY, engine);

http://dive4elements.wald.intevation.org