Package org.apache.jackrabbit.jcr2spi.state

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


        workspaceManager.execute(op);
        return op.getFailedIds();
    }

    public NodeEntry getVersionableNodeEntry(NodeState versionState) throws RepositoryException {
        NodeState ns = versionState.getChildNodeState(NameConstants.JCR_FROZENNODE, Path.INDEX_DEFAULT);
        PropertyState ps = ns.getPropertyState(NameConstants.JCR_FROZENUUID);
        String uniqueID = ps.getValue().getString();

        NodeId versionableId = workspaceManager.getIdFactory().createNodeId(uniqueID);
        return workspaceManager.getHierarchyManager().getNodeEntry(versionableId);
    }
View Full Code Here


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

    }

    public NodeEntry resolve(NodeId nodeId, NodeEntry rootEntry) throws ItemNotFoundException, RepositoryException {
        NodeEntry entry = lookup(nodeId.getUniqueID());
        if (entry == null) {
            NodeState state = isf.createDeepNodeState(nodeId, rootEntry);
            entry = state.getNodeEntry();
        }
        return entry;
    }
View Full Code Here

     * @see HierarchyManager#getNodeState(Path)
     */
    public NodeState getNodeState(Path qPath) throws PathNotFoundException, RepositoryException {
        NodeEntry entry = getNodeEntry(qPath);
        try {
            NodeState state = entry.getNodeState();
            if (state.isValid()) {
                return state;
            } else {
                throw new PathNotFoundException(LogUtil.safeGetJCRPath(qPath, resolver));
            }
        } catch (ItemNotFoundException e) {
View Full Code Here

     * @see ItemManager#nodeExists(Path)
     */
    public boolean nodeExists(Path path) throws RepositoryException {
        try {
            // session-sanity & permissions are checked upon itemExists(ItemState)
            NodeState nodeState = hierMgr.getNodeState(path);
            return itemExists(nodeState);
        } catch (PathNotFoundException pnfe) {
            return false;
        } catch (ItemNotFoundException infe) {
            return false;
View Full Code Here

            String msg = "Unable to resolve merge conflict. Specified version is not in jcr:mergeFailed property: " + safeGetJCRPath();
            log.error(msg);
            throw new VersionException(msg);
        }

        NodeState versionState = session.getVersionState(version);
        session.getVersionStateManager().resolveMergeConflict(getNodeState(), versionState, done);
    }
View Full Code Here

            }
            targetNode.checkIsLocked();
            // NOTE: check for nodetype constraint violation is left to the 'server'
        }

        NodeState versionState = session.getVersionState(version);
        session.getVersionStateManager().restore(targetNode.getNodeState(), relQPath, versionState, removeExisting);
    }
View Full Code Here

       if (isClosed()) {
           // workspace-importer only: ignore if import has been aborted before.
           return;
       }
       checkSession();
       NodeState parent = parents.peek();
       if (parent == null) {
           // parent node was skipped, skip this child node also
           parents.push(null); // push null onto stack for skipped node
           log.debug("Skipping node '" + nodeInfo.getName() + "'.");
           return;
       }

       NodeEntry parentEntry = (NodeEntry) parent.getHierarchyEntry();
       NodeState nodeState = null;

       if (parentEntry.hasNodeEntry(nodeInfo.getName())) {
           try {
               // a valid child node with that name already exists
               NodeEntry entry = parentEntry.getNodeEntry(nodeInfo.getName(), Path.INDEX_DEFAULT);
               NodeState existing = entry.getNodeState();

               QNodeDefinition def = existing.getDefinition();
               if (!def.allowsSameNameSiblings()) {
                   // existing doesn't allow same-name siblings, check for conflicts
                   EffectiveNodeTypeProvider provider = session.getEffectiveNodeTypeProvider();
                   Name[] ntNames = existing.getAllNodeTypeNames();
                   EffectiveNodeType entExisting = provider.getEffectiveNodeType(ntNames);
                   if (def.isProtected() && entExisting.includesNodeType(nodeInfo.getNodeTypeName())) {
                       // skip protected node
                       parents.push(null); // push null onto stack for skipped node
                       log.debug("skipping protected node " + LogUtil.safeGetJCRPath(existing, session.getPathResolver()));
View Full Code Here

     * @return
     * @throws RepositoryException
     */
    NodeState resolveUUIDConflict(NodeState parent, NodeEntry conflicting,
                                  NodeInfo nodeInfo) throws ItemExistsException, RepositoryException {
        NodeState nodeState;
        switch (uuidBehavior) {
            case ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW:
                String originalUUID = nodeInfo.getUUID();
                String newUUID = UUID.randomUUID().toString();
                // reset id on nodeInfo to force creation with new uuid:
View Full Code Here

                ntName = def.getDefaultPrimaryType();
            }
            Operation an = AddNode.create(parent, nodeInfo.getName(), ntName, nodeInfo.getUUID());
            stateMgr.execute(an);
            // retrieve id of state that has been created during execution of AddNode
            NodeState childState = (NodeState) ((AddNode) an).getAddedStates().get(0);

            // and set mixin types
            Name[] mixinNames = nodeInfo.getMixinNames();
            if (mixinNames != null && mixinNames.length > 0) {
                Operation sm = SetMixin.create(childState, nodeInfo.getMixinNames());
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.jcr2spi.state.NodeState

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.