cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johnth...@apache.org
Subject svn commit: r1529311 - /cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectSet.java
Date Fri, 04 Oct 2013 21:33:13 GMT
Author: johnthuss
Date: Fri Oct  4 21:33:12 2013
New Revision: 1529311

URL: http://svn.apache.org/r1529311
Log:
Track changes in PersistentObjectSet.retainAll

Modified:
    cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectSet.java

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectSet.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectSet.java?rev=1529311&r1=1529310&r2=1529311&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectSet.java
(original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectSet.java
Fri Oct  4 21:33:12 2013
@@ -202,8 +202,18 @@ public class PersistentObjectSet extends
     }
 
     public boolean retainAll(Collection c) {
-        // TODO: handle object graoh change notifications on object removals...
-        return resolvedObjectSet().retainAll(c);
+    	Collection toRemove = new HashSet(resolvedObjectSet().size());
+    	for (Object object : resolvedObjectSet()) {
+			if (!c.contains(object)) {
+				toRemove.add(object);
+			}
+		}
+    	
+        boolean result = resolvedObjectSet().retainAll(c);
+        if (result) {
+        	postprocessRemove(toRemove);
+        }
+        return result;
     }
 
     public int size() {



Mime
View raw message