private void removeReferrerChanges ( Set < NodeKey > allChanges , Set < NodeKey > changesAtOrBelowThis ) throws RepositoryException { // check if there are any nodes in the overall list of changes (and outside the branch) due to reference changes for ( Iterator < NodeKey > allChangesIt = allChanges . iterator ( ) ; allChangesIt . hasNext ( ) ; ) { NodeKey changedNodeKey = allChangesIt . next ( ) ; if ( changesAtOrBelowThis . contains ( changedNodeKey ) ) { continue ; } MutableCachedNode changedNodeOutsideBranch = session ( ) . cache ( ) . mutable ( changedNodeKey ) ; AbstractJcrNode changedNode = null ; try { changedNode = session ( ) . node ( changedNodeKey , null ) ; } catch ( ItemNotFoundException e ) { // node was deleted allChangesIt . remove ( ) ; continue ; } boolean isShareable = changedNode . isShareable ( ) ; if ( isShareable /* && changedNodeOutsideBranch.hasOnlyChangesToAdditionalParents() */ ) { // assume that a shared node was added/removed and is to be included ... allChangesIt . remove ( ) ; continue ; } boolean isReferenceable = changedNode . isReferenceable ( ) ; if ( ! isReferenceable ) { continue ; } Set < NodeKey > changedReferrers = changedNodeOutsideBranch . getChangedReferrerNodes ( ) ; for ( NodeKey changedNodeInBranchKey : changesAtOrBelowThis ) { if ( changedReferrers . contains ( changedNodeInBranchKey ) ) { // one of the changes in the branch is a referrer of the node outside the branch so we won't take the outside // node into account allChangesIt . remove ( ) ; } } } }
Removes all the keys from the first set which represent referrer node keys to any of the nodes in the second set .