jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r508454 - /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
Date Fri, 16 Feb 2007 15:41:01 GMT
Author: mreutegg
Date: Fri Feb 16 07:41:00 2007
New Revision: 508454

URL: http://svn.apache.org/viewvc?view=rev&rev=508454
Log:
ChangeLog.removeAffected() removes too many operations
- must also check name of item state

Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java?view=diff&rev=508454&r1=508453&r2=508454
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
Fri Feb 16 07:41:00 2007
@@ -118,6 +118,7 @@
      * Call this method when this change log has been sucessfully persisted.
      * This implementation will call {@link ItemState#persisted(ChangeLog, CacheBehaviour)
      * ItemState.refresh(this)} on the target item of this change log.
+     * TODO: remove parameter CacheBehaviour
      */
     public void persisted(CacheBehaviour cacheBehaviour) {
         target.persisted(this, cacheBehaviour);
@@ -253,12 +254,21 @@
                             if (parent.getStatus() != Status.REMOVED) {
                                 for (Iterator it = operations.iterator(); it.hasNext();)
{
                                     Operation op = (Operation) it.next();
-                                    if (op instanceof AddNode && ((AddNode)op).getParentState()
== parent) {
-                                        it.remove();
-                                        break;
-                                    } else if (op instanceof AddProperty && ((AddProperty)op).getParentState()
== parent) {
-                                        it.remove();
-                                        break;
+                                    if (op instanceof AddNode) {
+                                        AddNode operation = (AddNode) op;
+                                        if (operation.getParentState() == parent
+                                                && operation.getNodeName().equals(state.getQName()))
{
+                                            // TODO: this will not work for name name siblings!
+                                            it.remove();
+                                            break;
+                                        }
+                                    } else if (op instanceof AddProperty) {
+                                        AddProperty operation = (AddProperty) op;
+                                        if (operation.getParentState() == parent
+                                                && operation.getPropertyName().equals(state.getQName()))
{
+                                            it.remove();
+                                            break;
+                                        }
                                     } else if (op instanceof SetMixin &&
                                         QName.JCR_MIXINTYPES.equals(state.getQName()) &&
                                         ((SetMixin)op).getNodeState() == parent) {



Mime
View raw message