[seam-commits] Seam SVN: r8346 - trunk/src/main/org/jboss/seam/contexts.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Fri Jun 6 19:09:28 EDT 2008
Author: norman.richards at jboss.com
Date: 2008-06-06 19:09:28 -0400 (Fri, 06 Jun 2008)
New Revision: 8346
Modified:
trunk/src/main/org/jboss/seam/contexts/ServerConversationContext.java
Log:
JBSEAM-3078
Modified: trunk/src/main/org/jboss/seam/contexts/ServerConversationContext.java
===================================================================
--- trunk/src/main/org/jboss/seam/contexts/ServerConversationContext.java 2008-06-06 21:44:58 UTC (rev 8345)
+++ trunk/src/main/org/jboss/seam/contexts/ServerConversationContext.java 2008-06-06 23:09:28 UTC (rev 8346)
@@ -276,19 +276,26 @@
//force update for dirty mutable objects
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