Package org.modeshape.jcr.cache

Examples of org.modeshape.jcr.cache.ReferrerCounts$MutableReferrerCounts


            // Restore the back references ...
            if (!referrersByNodeKey.isEmpty()) {
                for (Map.Entry<NodeKey, ReferrerCounts> entry : referrersByNodeKey.entrySet()) {
                    PropertyFactory propFactory = context.getPropertyFactory();
                    MutableCachedNode referred = cache.mutable(entry.getKey());
                    ReferrerCounts counts = entry.getValue();
                    if (referred != null && counts != null) {
                        // Add in the strong and weak referrers (that are outside the import scope) that used to be in the node
                        // before it was replaced ...
                        for (NodeKey key : counts.getStrongReferrers()) {
                            int count = counts.countStrongReferencesFrom(key);
                            for (int i = 0; i != count; ++i) {
                                Property prop = propFactory.create(nameFor(key.toString() + i));
                                referred.addReferrer(cache, prop, key, ReferenceType.STRONG);
                            }
                        }
                        for (NodeKey key : counts.getWeakReferrers()) {
                            int count = counts.countWeakReferencesFrom(key);
                            for (int i = 0; i != count; ++i) {
                                Property prop = propFactory.create(nameFor(key.toString() + i));
                                referred.addReferrer(cache, prop, key, ReferenceType.WEAK);
                            }
                        }
View Full Code Here


        protected void preRemoveNode( AbstractJcrNode removedNode ) {
            // Figure out if the node has backreferences ...
            CachedNode node;
            try {
                node = removedNode.node();
                ReferrerCounts referrers = node.getReferrerCounts(cache);
                if (referrers != null) referrersByNodeKey.put(node.getKey(), referrers);
            } catch (ItemNotFoundException | InvalidItemStateException err) {
                // do nothing ...
            }
        }
View Full Code Here

        if (persisted == null) {
            if (changes == null) return null;
            return changes.getReferrerCounts(null);
        }
        // Read the referrers from the workspace node ...
        ReferrerCounts persistedCounts = persisted.getReferrerCounts(workspace(cache));
        return changes == null ? persistedCounts : changes.getReferrerCounts(persistedCounts);
    }
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.cache.ReferrerCounts$MutableReferrerCounts

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.