changeset 1094:b1c6d945848d

Added a new method to FLYSArtifact to destroy a single state (call its endOfLife). flys-artifacts/trunk@2597 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 26 Aug 2011 14:55:18 +0000
parents 139e7df1787c
children f465785ed1ae
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Aug 26 12:45:32 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Aug 26 14:55:18 2011 +0000
@@ -1,3 +1,8 @@
+2011-08-26  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: New method
+	  to destroy a single state.
+
 2011-08-26  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Fri Aug 26 12:45:32 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Fri Aug 26 14:55:18 2011 +0000
@@ -374,7 +374,6 @@
             int targetIdx        = prevs.indexOf(targetState);
             int start            = prevs.size() - 1;
 
-            prevs.add(getCurrentStateId());
             destroyStates(prevs, context);
 
             for (int i = start; i >= targetIdx; i--) {
@@ -385,6 +384,7 @@
                 facets.remove(prev);
             }
 
+            destroyState(getCurrentStateId(), context);
             setCurrentStateId(targetState);
 
             return describe(target, context);
@@ -919,6 +919,12 @@
     }
 
 
+    protected void destroyState(String id, Object context) {
+        State s = getState(context, id);
+        s.endOfLife(this, context);
+    }
+
+
     /**
      * Calls endOfLife() for each state in the list <i>ids</i>.
      *
@@ -927,8 +933,7 @@
      */
     protected void destroyStates(List<String> ids, Object context) {
         for (int i = 0, num = ids.size(); i < num; i++) {
-            State s = getState(context, ids.get(i));
-            s.endOfLife(this, context);
+            destroyState(ids.get(i), context);
         }
     }
 

http://dive4elements.wald.intevation.org