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

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Aug 4 10:32:51 EDT 2008


Author: manaRH
Date: 2008-08-04 10:32:50 -0400 (Mon, 04 Aug 2008)
New Revision: 8567

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

Modified: branches/Seam_2_0_FP/src/main/org/jboss/seam/contexts/ServerConversationContext.java
===================================================================
--- branches/Seam_2_0_FP/src/main/org/jboss/seam/contexts/ServerConversationContext.java	2008-08-04 14:28:39 UTC (rev 8566)
+++ branches/Seam_2_0_FP/src/main/org/jboss/seam/contexts/ServerConversationContext.java	2008-08-04 14:32:50 UTC (rev 8567)
@@ -277,8 +277,10 @@
           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
@@ -288,7 +290,8 @@
           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); 
           }
           additions.clear();
       }
@@ -301,13 +304,24 @@
          }
       }
    }
+  
+   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) || 
-            ( attribute instanceof Wrapper && ( (Wrapper) attribute ).passivate() );
+      return Contexts.isAttributeDirty(attribute);
    }
-
+   
    private boolean isCurrent()
    {
       return id==null || id.equals( Manager.instance().getCurrentConversationId() );




More information about the seam-commits mailing list