Package org.apache.jackrabbit.jcr2spi.hierarchy

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


    /**
     * @see Node#getNode(String)
     */
    public Node getNode(String relPath) throws PathNotFoundException, RepositoryException {
        checkStatus();
        NodeEntry nodeEntry = resolveRelativeNodePath(relPath);
        if (nodeEntry == null) {
            throw new PathNotFoundException(relPath);
        }
        try {
            return (Node) getItemManager().getItem(nodeEntry);
View Full Code Here


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

    Version checkpoint() throws RepositoryException {
        checkIsVersionable();
        checkHasPendingChanges();
        checkIsLocked();
        NodeEntry newVersion = session.getVersionStateManager().checkpoint(getNodeState());
        return (Version) getItemManager().getItem(newVersion);
    }
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

     * @param propertyName
     * @throws ItemExistsException
     * @throws RepositoryException
     */
    private void checkCollision(NodeState parentState, Name propertyName) throws ItemExistsException, RepositoryException {
        NodeEntry parentEntry = (NodeEntry) parentState.getHierarchyEntry();
         // NOTE: check for name collisions with existing child node has been
         // removed as with JSR 283 having same-named node and property can be
         // allowed. thus delegate the correspoding validation to the underlying
         // SPI implementation.

        // check for name collisions with an existing property
        PropertyEntry pe = parentEntry.getPropertyEntry(propertyName);
        if (pe != null) {
            try {
                pe.getPropertyState();
                throw new ItemExistsException("Property '" + pe.getName() + "' already exists.");
            } catch (ItemNotFoundException e) {
View Full Code Here

        // shortcut: if state is new, its ancestor must be checkout
        if (nodeState.getStatus() == Status.NEW) {
            return true;
        }

        NodeEntry nodeEntry = nodeState.getNodeEntry();
        try {
            // NOTE: since the hierarchy might not be completely loaded or some
            // entry might even not be accessible, the check may not detect
            // a checked-in parent. ok, as long as the 'server' finds out upon
            // save or upon executing the workspace operation.
            while (!nodeEntry.hasPropertyEntry(NameConstants.JCR_ISCHECKEDOUT)) {
                NodeEntry parent = nodeEntry.getParent();
                if (parent == null) {
                    // reached root state without finding a jcr:isCheckedOut property
                    return true;
                }
                nodeEntry = parent;
View Full Code Here

     * @return The <code>NodeState</code> with the specified name and index
     * @throws ItemNotFoundException
     * @throws RepositoryException
     */
    public NodeState getChildNodeState(Name nodeName, int index) throws ItemNotFoundException, RepositoryException {
        NodeEntry ne = getNodeEntry().getNodeEntry(nodeName, index, true);
        if (ne != null) {
            return ne.getNodeState();
        } else {
            // does not exist (any more) or is a property
            throw new ItemNotFoundException("Child node "+ nodeName +" with index " + index + " does not exist.");
        }
    }
View Full Code Here

     * <code>beforeNode</code> is not a child node of this <code>NodeState</code>.
     */
    synchronized void reorderChildNodeEntries(NodeState insertNode, NodeState beforeNode)
        throws ItemNotFoundException, RepositoryException {

        NodeEntry before = (beforeNode == null) ? null : beforeNode.getNodeEntry();
        insertNode.getNodeEntry().orderBefore(before);

        // mark this state as modified
        markModified();
    }
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.