[seam-commits] Seam SVN: r8345 - branches/Seam_2_0/src/main/org/jboss/seam/contexts.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Jun 6 17:44:58 EDT 2008


Author: norman.richards at jboss.com
Date: 2008-06-06 17:44:58 -0400 (Fri, 06 Jun 2008)
New Revision: 8345

Modified:
   branches/Seam_2_0/src/main/org/jboss/seam/contexts/ServerConversationContext.java
Log:
JBSEAM-3078

Modified: branches/Seam_2_0/src/main/org/jboss/seam/contexts/ServerConversationContext.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/contexts/ServerConversationContext.java	2008-06-06 21:12:45 UTC (rev 8344)
+++ branches/Seam_2_0/src/main/org/jboss/seam/contexts/ServerConversationContext.java	2008-06-06 21:44:58 UTC (rev 8345)
@@ -277,18 +277,25 @@
           for (String key: getNamesForAllConversationsFromSession())  {
               Object attribute = session.get(key);
             
-              if ( attribute!=null && isAttributeDirty(attribute) ) {
-                  session.put(key, attribute);
+              if (attribute!=null) {
+                  if (passivate(attribute) || isAttributeDirty(attribute)) {
+                      session.put(key, attribute);
+                  }
               }
           }
+
           //remove removed objects
           for (String name: removals) {
               session.remove(getKey(name));
           }
           removals.clear();
+
           //add new objects
           for (Map.Entry<String, Object> entry: additions.entrySet())  {
-              session.put( getKey( entry.getKey() ), entry.getValue() );
+              Object attribute = entry.getValue();
+
+              passivate(attribute); 
+              session.put(getKey(entry.getKey()), attribute);
           }
           additions.clear();
       }
@@ -302,12 +309,18 @@
       }
    }
 
-   private boolean isAttributeDirty(Object attribute)
-   {
-      return Contexts.isAttributeDirty(attribute) || 
-            ( attribute instanceof Wrapper && ( (Wrapper) attribute ).passivate() );
-   }
+    private boolean passivate(Object attribute) {
+        if (attribute instanceof Wrapper) {
+            return ((Wrapper) attribute).passivate();
+        } else {
+            return false;
+        }
+    }
 
+    private boolean isAttributeDirty(Object attribute) {
+        return Contexts.isAttributeDirty(attribute);
+    }
+
    private boolean isCurrent()
    {
       return id==null || id.equals( Manager.instance().getCurrentConversationId() );




More information about the seam-commits mailing list