Package org.apache.jackrabbit.jcr2spi.hierarchy

Examples of org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry


        }

        Set ops = new LinkedHashSet();
        Set affectedStates = new LinkedHashSet();

        HierarchyEntry he = target.getHierarchyEntry();
        if (he.getParent() == null) {
            // the root entry -> the complete change log can be used for
            // simplicity. collecting ops, states can be omitted.
            if (throwOnStale && !staleStates.isEmpty()) {
                String msg = "Cannot save changes: States has been modified externally.";
                log.debug(msg);
View Full Code Here


     * @param parent
     * @param state
     * @return
     */
    private static boolean containedInTree(ItemState parent, ItemState state) {
        HierarchyEntry he = state.getHierarchyEntry();
        HierarchyEntry pHe = parent.getHierarchyEntry();
        // short cuts first
        if (he == pHe || he.getParent() == pHe) {
            return true;
        }
        if (!parent.isNode() || he == pHe.getParent()) {
            return false;
        }
        // none of the simple cases: walk up hierarchy
        HierarchyEntry pe = he.getParent();
        while (pe != null) {
            if (pe == pHe) {
                return true;
            }
            pe = pe.getParent();
        }

        // state isn't descendant of 'parent'
        return false;
    }
View Full Code Here

        if (version.getSession() == this) {
            nodeState = (NodeState) ((NodeImpl) version).getItemState();
        } else {
            Path p = getQPath(version.getPath());
            Path parentPath = p.getAncestor(1);
            HierarchyEntry parentEntry = getHierarchyManager().lookup(parentPath);
            if (parentEntry != null) {
                // make sure the parent entry is up to date
                parentEntry.invalidate(false);
            }
            nodeState = getHierarchyManager().getNodeState(p);
        }
        return nodeState;
    }
View Full Code Here

        }
        // process all remaining states that were not covered by the
        // operation persistence.
        for (Iterator it = affectedStates.iterator(); it.hasNext();) {
            ItemState state = (ItemState) it.next();
            HierarchyEntry he = state.getHierarchyEntry();

            switch (state.getStatus()) {
                case Status.EXISTING_MODIFIED:
                    state.setStatus(Status.EXISTING);
                    if (state.isNode() && changedMixins.contains(state)) {
                        // mixin changed for a node -> force reloading upon next
                        // access in order to be aware of modified uniqueID.
                        he.invalidate(false);
                    }
                    break;
                case Status.EXISTING_REMOVED:
                    he.remove();
                    break;
                case Status.NEW:
                    // illegal. should not get here.
                    log.error("ChangeLog still contains NEW state: " + state.getName());
                    state.setStatus(Status.EXISTING);
                    break;
                case Status.MODIFIED:
                case Status._UNDEFINED_:
                case Status.STALE_DESTROYED:
                case Status.STALE_MODIFIED:
                    // illegal.
                    log.error("ChangeLog contains state (" + state.getName() + ") with illegal status " + Status.getName(state.getStatus()));
                    break;
                case Status.EXISTING:
                    if (state.isNode() && changedMixins.contains(state)) {
                        // mixin changed for a node -> force reloading upon next
                        // access in order to be aware of modified uniqueID.
                        he.invalidate(false);
                    }
                    // otherwise: ignore. operations already have been completed
                    break;
                case Status.INVALIDATED:
                case Status.REMOVED:
View Full Code Here

     *
     * @param state
     * @throws RepositoryException
     */
    private static void updateId(ItemState state) throws RepositoryException {
        HierarchyEntry he = state.getHierarchyEntry();
        while (he.getStatus() != Status.INVALIDATED) {
            he = he.getParent();
            if (he == null) {
                // root reached without intermediate invalidated entry
                return;
            }
        }
        // he is INVALIDATED -> force reloading in order to be aware of id changes
        he.getItemState();
    }
View Full Code Here

    public void persisted() {
        assert status == STATUS_PENDING;
        if (removeExisting) {
            status = STATUS_PERSISTED;
            // invalidate the complete tree -> find root-hierarchy-entry
            HierarchyEntry he = destParentState.getHierarchyEntry();
            while (he.getParent() != null) {
                he = he.getParent();
            }
            he.invalidate(true);
        } else {
            super.persisted();
        }
    }
View Full Code Here

     *
     * @param state
     * @throws RepositoryException
     */
    private static void updateId(ItemState state) throws RepositoryException {
        HierarchyEntry he = state.getHierarchyEntry();
        while (he.getStatus() != Status.INVALIDATED) {
            he = he.getParent();
            if (he == null) {
                // root reached without intermediate invalidated entry
                return;
            }
        }
        // he is INVALIDATED -> force reloading in order to be aware of id changes
        he.getItemState();
    }
View Full Code Here

        assert status == STATUS_PENDING;
        status = STATUS_PERSISTED;
        if (isActivityMerge()) {
            // TODO be more specific about what needs to be invalidated
            // look for the root entry and invalidate the complete tree
            HierarchyEntry entry = nodeState.getNodeEntry();
            while (entry.getParent() != null) {
                entry = entry.getParent();
            }
            entry.invalidate(true);
        } else {
            try {
                NodeEntry vhe = mgr.getVersionHistoryEntry(nodeState);
                if (vhe != null) {
                    vhe.invalidate(true);
View Full Code Here

        }
        // process all remaining states that were not covered by the
        // operation persistence.
        for (Iterator it = affectedStates.iterator(); it.hasNext();) {
            ItemState state = (ItemState) it.next();
            HierarchyEntry he = state.getHierarchyEntry();

            switch (state.getStatus()) {
                case Status.EXISTING_MODIFIED:
                    state.setStatus(Status.EXISTING);
                    if (state.isNode()) {
                        if (changedPrimaryTypes.contains(state)) {
                            // primary type changed for a node -> force reloading upon next
                            // access in order to be aware of modified definition etc...
                            he.invalidate(true);
                        } else if (changedMixins.contains(state)) {
                            // mixin changed for a node -> force reloading upon next
                            // access in order to be aware of modified uniqueID.
                            he.invalidate(false);
                        }
                    }
                    break;
                case Status.EXISTING_REMOVED:
                    he.remove();
                    break;
                case Status.NEW:
                    // illegal. should not get here.
                    log.error("ChangeLog still contains NEW state: " + state.getName());
                    state.setStatus(Status.EXISTING);
                    break;
                case Status.MODIFIED:
                case Status._UNDEFINED_:
                case Status.STALE_DESTROYED:
                case Status.STALE_MODIFIED:
                    // illegal.
                    log.error("ChangeLog contains state (" + state.getName() + ") with illegal status " + Status.getName(state.getStatus()));
                    break;
                case Status.EXISTING:
                    if (state.isNode() && changedMixins.contains(state)) {
                        // mixin changed for a node -> force reloading upon next
                        // access in order to be aware of modified uniqueID.
                        he.invalidate(false);
                    }
                    // otherwise: ignore. operations already have been completed
                    break;
                case Status.INVALIDATED:
                case Status.REMOVED:
View Full Code Here

        }

        Set ops = new LinkedHashSet();
        Set affectedStates = new LinkedHashSet();

        HierarchyEntry he = target.getHierarchyEntry();
        if (he.getParent() == null) {
            // the root entry -> the complete change log can be used for
            // simplicity. collecting ops, states can be omitted.
            if (throwOnStale && !staleStates.isEmpty()) {
                String msg = "Cannot save changes: States has been modified externally.";
                log.debug(msg);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry

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.