Examples of NodeState


Examples of org.apache.jackrabbit.core.state.NodeState

        // just let the mgr create the new property that is known to exist and
        // which has not been accessed before.
        PropertyImpl prop = (PropertyImpl) itemMgr.createItemInstance(propState);

        // modify the state of 'this', i.e. the parent node
        NodeState thisState = (NodeState) getOrCreateTransientItemState();
        // add new property entry
        thisState.addPropertyName(name);

        return prop;
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.state.NodeState

    protected synchronized NodeImpl createChildNode(Name name,
                                                    NodeTypeImpl nodeType,
                                                    NodeId id)
            throws RepositoryException {
        // create a new node state
        NodeState nodeState;
        try {
            if (id == null) {
                id = new NodeId();
            }
            nodeState =
                    stateMgr.createTransientNodeState(id, nodeType.getQName(),
                            getNodeId(), ItemState.STATUS_NEW);
        } catch (ItemStateException ise) {
            String msg = "failed to add child node " + name + " to " + this;
            log.debug(msg);
            throw new RepositoryException(msg, ise);
        }

        // create Node instance wrapping new node state
        NodeImpl node;
        try {
            // NOTE: since the node is not yet connected to its parent, avoid
            // calling ItemManager#getItem(ItemId) which may include a permission
            // check (with subsequent usage of the hierarachy-mgr -> error).
            // just let the mgr create the new node that is known to exist and
            // which has not been accessed before.
            node = (NodeImpl) itemMgr.createItemInstance(nodeState);
        } catch (RepositoryException re) {
            // something went wrong
            stateMgr.disposeTransientItemState(nodeState);
            // re-throw
            throw re;
        }

        // modify the state of 'this', i.e. the parent node
        NodeState thisState = (NodeState) getOrCreateTransientItemState();
        // add new child node entry
        thisState.addChildNodeEntry(name, nodeState.getNodeId());

        // add 'auto-create' properties defined in node type
        for (PropertyDefinition aPda : nodeType.getAutoCreatedPropertyDefinitions()) {
            PropertyDefinitionImpl pd = (PropertyDefinitionImpl) aPda;
            node.createChildProperty(pd.unwrap().getName(), pd.getRequiredType(), pd);
View Full Code Here

Examples of org.apache.jackrabbit.core.state.NodeState

    protected void renameChildNode(Name oldName, int index, NodeId id,
                                   Name newName)
            throws RepositoryException {
        // modify the state of 'this', i.e. the parent node
        NodeState thisState = (NodeState) getOrCreateTransientItemState();
        thisState.renameChildNodeEntry(oldName, index, newName);
    }
View Full Code Here

Examples of org.apache.jackrabbit.jcr2spi.state.NodeState

            String msg = "Cannot move the root node.";
            log.debug(msg);
            throw new RepositoryException(msg);
        }

        NodeState srcState = getNodeState(srcPath, hierMgr);
        NodeState srcParentState = getNodeState(srcPath.getAncestor(1), hierMgr);
        NodeState destParentState = getNodeState(destPath.getAncestor(1), hierMgr);
        Name destName = destPath.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);
View Full Code Here

Examples of org.apache.jackrabbit.jcr2spi.state.NodeState

        /**
         * @see OperationVisitor#visit(RemoveVersion)
         */
        public void visit(RemoveVersion operation) throws VersionException, AccessDeniedException, ReferentialIntegrityException, RepositoryException {
            NodeId versionId = (NodeId) operation.getRemoveId();
            NodeState vhState = operation.getParentState();
            service.removeVersion(sessionInfo, (NodeId) vhState.getWorkspaceId(), versionId);
        }
View Full Code Here

Examples of org.apache.jackrabbit.jcr2spi.state.NodeState

        Path targetPath = getQPath(absPath);

        boolean isGranted;
        // The given abs-path may point to a non-existing item
        if (itemManager.nodeExists(targetPath)) {
            NodeState nState = getHierarchyManager().getNodeState(targetPath);
            isGranted = getAccessManager().isGranted(nState, actionsArr);
        } else if (itemManager.propertyExists(targetPath)) {
            PropertyState pState = getHierarchyManager().getPropertyState(targetPath);
            isGranted = getAccessManager().isGranted(pState, actionsArr);
        } else {
            NodeState parentState = null;
            Path parentPath = targetPath;
            while (parentState == null) {
                parentPath = parentPath.getAncestor(1);
                if (itemManager.nodeExists(parentPath)) {
                    parentState = getHierarchyManager().getNodeState(parentPath);
View Full Code Here

Examples of org.apache.jackrabbit.jcr2spi.state.NodeState

     *
     * @param version
     * @return the NodeState associated with the specified version.
     */
    NodeState getVersionState(Version version) throws RepositoryException {
        NodeState nodeState;
        if (version.getSession() == this) {
            nodeState = (NodeState) ((NodeImpl) version).getItemState();
        } else {
            Path p = getQPath(version.getPath());
            Path parentPath = p.getAncestor(1);
View Full Code Here

Examples of org.apache.jackrabbit.jcr2spi.state.NodeState

            NodeState parentState, Path srcPath, Path beforePath)
            throws ItemNotFoundException, RepositoryException {
        // make sure the parent hierarchy entry has its child entries loaded
        assertChildNodeEntries(parentState);

        NodeState insert = parentState.getChildNodeState(
                srcPath.getName(), srcPath.getNormalizedIndex());
        NodeState before = null;
        if (beforePath != null) {
            before = parentState.getChildNodeState(
                    beforePath.getName(), beforePath.getNormalizedIndex());
        }
        return new ReorderNodes(parentState, insert, before);
View Full Code Here

Examples of org.apache.jackrabbit.mk.model.NodeState

            throw new IllegalStateException("not initialized");
        } else if (!PathUtils.isAbsolute(path)) {
            throw new IllegalArgumentException("illegal path");
        }

        NodeState node = rs.getNodeState(rs.getRootNode(revId));
        for (String name : PathUtils.split(path)) {
            node = node.getChildNode(name);
            if (node == null) {
                break;
            }
        }
        return node;
View Full Code Here

Examples of org.apache.jackrabbit.mk.model.tree.NodeState

            throw new IllegalStateException("not initialized");
        } else if (!PathUtils.isAbsolute(path)) {
            throw new IllegalArgumentException("illegal path");
        }

        NodeState node = rs.getNodeState(rs.getRootNode(revId));
        for (String name : PathUtils.elements(path)) {
            node = node.getChildNode(name);
            if (node == null) {
                break;
            }
        }
        return node;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.