Package org.apache.jackrabbit.jcr2spi.hierarchy

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


        assert status == STATUS_PENDING;
        status = STATUS_PERSISTED;
       
        // invalidate all references to the removed activity
        for (int i = 0; i < refs.length; i++) {
            HierarchyEntry entry = hMgr.lookup(refs[i]);
            if (entry != null) {
                entry.invalidate(false);
            }
        }

        // invalidate the activities parent
        parent.getNodeEntry().invalidate(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

     *
     * @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

            } else {
                info = cached.info;
            }

            // Build the hierarchy entry for the item info
            HierarchyEntry entry = createHierarchyEntries(info, anyParent);
            if (entry == null || !entry.denotesNode()) {
                throw new ItemNotFoundException(
                        "HierarchyEntry does not belong to any existing ItemInfo. No ItemState was created.");
            } else {
                // Now we can check whether the item info from the cache is up to date
                long generation = entry.getGeneration();
                if (isOutdated(cached, entry)) {
                    // if not, retrieve the item info from the service and put the whole batch into the cache
                    infos = service.getItemInfos(sessionInfo, nodeId);
                    info = first(infos, cache, generation);
                } else if (infos != null) {
View Full Code Here

            } else {
                info = cached.info;
            }

            // Build the hierarchy entry for the item info
            HierarchyEntry entry = createHierarchyEntries(info, anyParent);
            if (entry == null || entry.denotesNode()) {
                throw new ItemNotFoundException(
                        "HierarchyEntry does not belong to any existing ItemInfo. No ItemState was created.");
            } else {
                long generation = entry.getGeneration();
                if (isOutdated(cached, entry)) {
                    // if not, retrieve the item info from the service and put the whole batch into the cache
                    infos = service.getItemInfos(sessionInfo, propertyId);
                    info = first(infos, cache, generation);
                } else if (infos != null) {
View Full Code Here

        throws ItemNotFoundException, RepositoryException {
        this.itemMgr = itemMgr;
        List<HierarchyEntry> entries = new ArrayList<HierarchyEntry>();
        while (itemIds.hasNext()) {
            ItemId id = itemIds.next();
            HierarchyEntry entry;
            if (id.denotesNode()) {
                entry = hierarchyMgr.getNodeEntry((NodeId) id);
            } else {
                entry = hierarchyMgr.getPropertyEntry((PropertyId) id);
            }
View Full Code Here

     * <code>null</code> in case there are no more items.
     */
    private Item prefetchNext() {
        Item nextItem = null;
        while (nextItem == null && iter.hasNext()) {
            HierarchyEntry entry = iter.next();
            try {
                nextItem = itemMgr.getItem(entry);
            } catch (RepositoryException e) {
                log.warn("Failed to fetch item " + entry.getName() + ", skipping.", e.getMessage());
                // reduce the size... and try the next one
                size--;
            }
        }
        return nextItem;
View Full Code Here

        }

        // skip the first (skipNum - 1) items without actually retrieving them
        while (--skipNum > 0) {
            pos++;
            HierarchyEntry entry = iter.next();
            // check if item exists but don't build Item instance.
            boolean itemExists = false;
            while(!itemExists){
                try{
                    itemExists = itemMgr.itemExists(entry);
View Full Code Here

        }

        Set<Operation> ops = new LinkedHashSet<Operation>();
        Set<ItemState> affectedStates = new LinkedHashSet<ItemState>();

        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

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.