Package org.apache.jackrabbit.jcr2spi.hierarchy

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


    /**
     * @see Node#hasNode(String)
     */
    public boolean hasNode(String relPath) throws RepositoryException {
        checkStatus();
        NodeEntry nodeEntry = resolveRelativeNodePath(relPath);
        return (nodeEntry != null) && getItemManager().itemExists(nodeEntry);
    }
View Full Code Here


    public Version checkin() throws VersionException, UnsupportedRepositoryOperationException, InvalidItemStateException, LockException, RepositoryException {
        checkIsVersionable();
        checkHasPendingChanges();
        checkIsLocked();
        if (isCheckedOut()) {
            NodeEntry newVersion = session.getVersionStateManager().checkin(getNodeState());
            return (Version) getItemManager().getItem(newVersion);
        } else {
            // nothing to do
            log.debug("Node " + safeGetJCRPath() + " is already checked in.");
            return getBaseVersion();
View Full Code Here

        checkIsLocked();
        if (!isCheckedOut()) {
            checkout();
            return getBaseVersion();
        } else {
            NodeEntry newVersion;
            if (session.isSupportedOption(Repository.OPTION_ACTIVITIES_SUPPORTED)) {
                NodeImpl activity = (NodeImpl) session.getWorkspace().getVersionManager().getActivity();
                NodeId activityId = (activity == null) ? null : activity.getNodeState().getNodeId();
                newVersion = session.getVersionStateManager().checkpoint(getNodeState(), activityId);
            } else {
View Full Code Here

     * @throws RepositoryException
     */
    protected Node getNode(Name nodeName, int index) throws PathNotFoundException, RepositoryException {
        checkStatus();
        try {
            NodeEntry nEntry = getNodeEntry().getNodeEntry(nodeName, index);
            if (nEntry == null) {
                throw new PathNotFoundException(LogUtil.saveGetJCRName(nodeName, session.getNameResolver()));
            }
            return (Node) getItemManager().getItem(nEntry);
        } catch (AccessDeniedException e) {
View Full Code Here

     * <code>null</code> if no node exists at <code>relPath</code>.
     * @throws RepositoryException if <code>relPath</code> is not a valid
     * relative path.
     */
    private NodeEntry resolveRelativeNodePath(String relPath) throws RepositoryException {
        NodeEntry targetEntry = null;
        try {
            Path rp = session.getPathResolver().getQPath(relPath);
            // shortcut
            if (rp.getLength() == 1) {
                Path.Element pe = rp.getNameElement();
View Full Code Here

        NodeState srcParentState = getNodeState(srcPath.getAncestor(1), hierMgr);
        NodeState destParentState = getNodeState(destPath.getAncestor(1), hierMgr);
        Name destName = destElement.getName();

        if (sessionMove) {
            NodeEntry destEntry = (NodeEntry) destParentState.getHierarchyEntry();

            // force child node entries list to be present before the move is executed
            // on the hierarchy entry.
            assertChildNodeEntries(srcParentState);
            assertChildNodeEntries(destParentState);

            if (destEntry.hasNodeEntry(destName)) {
                NodeEntry existing = destEntry.getNodeEntry(destName, Path.INDEX_DEFAULT);
                if (existing != null && sessionMove) {
                    try {
                        if (!existing.getNodeState().getDefinition().allowsSameNameSiblings()) {
                            throw new ItemExistsException("Node existing at move destination does not allow same name siblings.");
                        }
                    } catch (ItemNotFoundException e) {
                        // existing apparent not valid any more -> probably no conflict
                    }
View Full Code Here

        return service.getChildInfos(sessionInfo, nodeId);
    }

    public Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName, boolean weak) {
        NodeEntry entry = nodeState.getNodeEntry();

        // Shortcut
        if (entry.getUniqueID() == null || !entry.hasPropertyEntry(NameConstants.JCR_UUID)) {
            // for sure not referenceable
            Set<PropertyId> t = Collections.emptySet();
            return t.iterator();
        }

        // Has a unique ID and is potentially mix:referenceable. Try to retrieve references
        try {
            return service.getReferences(sessionInfo, entry.getWorkspaceId(), propertyName, weak);
        } catch (RepositoryException e) {
            log.debug("Unable to determine references to {}", nodeState);
            Set<PropertyId> t = Collections.emptySet();
            return t.iterator();
        }
View Full Code Here

        Path path = info.getId().getPath();
        if (path == null) {
            entry.setUniqueID(uniqueID);
        } else if (uniqueID != null) {
            // uniqueID that applies to a parent NodeEntry -> get parentEntry
            NodeEntry parent = getAncestor(entry, path.getLength());
            parent.setUniqueID(uniqueID);
        }

        int previousStatus = entry.getStatus();
        if (Status.isTransient(previousStatus) || Status.isStale(previousStatus)) {
            log.debug("Node has pending changes; omit resetting the state.");
View Full Code Here

        // make sure uuid part of id is correct
        String uniqueID = info.getId().getUniqueID();
        if (uniqueID != null) {
            // uniqueID always applies to a parent NodeEntry -> get parentEntry
            NodeEntry parent = getAncestor(entry, info.getId().getPath().getLength());
            parent.setUniqueID(uniqueID);
        }

        int previousStatus = entry.getStatus();
        if (Status.isTransient(previousStatus) || Status.isStale(previousStatus)) {
            log.debug("Property has pending changes; omit resetting the state.");
View Full Code Here

        // Calculate relative path of missing entries
        Path anyParentPath = anyParent.getWorkspacePath();
        Path relPath = anyParentPath.computeRelativePath(info.getPath());
        Path.Element[] missingElems = relPath.getElements();

        NodeEntry entry = anyParent;
        int last = missingElems.length - 1;
        for (int i = 0; i <= last; i++) {
            if (missingElems[i].denotesParent()) {
                // Walk up the hierarchy for 'negative' paths
                // until the smallest common root is found
                entry = entry.getParent();
            } else if (missingElems[i].denotesName()) {
                // Add missing elements starting from the smallest common root
                Name name = missingElems[i].getName();
                int index = missingElems[i].getNormalizedIndex();

                if (i == last && !info.denotesNode()) {
                    return entry.getOrAddPropertyEntry(name);
                } else {
                    entry = createNodeEntry(entry, name, index);
                }
            }
        }
View Full Code Here

TOP

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

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.