Search in sources :

Example 21 with NodeEntry

use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.

the class NodeImpl method checkin.

/**
     * @see Node#checkin()
     */
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();
    }
}
Also used : NodeEntry(org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry) Version(javax.jcr.version.Version)

Example 22 with NodeEntry

use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.

the class NodeImpl method hasNode.

/**
     * @see Node#hasNode(String)
     */
public boolean hasNode(String relPath) throws RepositoryException {
    checkStatus();
    NodeEntry nodeEntry = resolveRelativeNodePath(relPath);
    return (nodeEntry != null) && getItemManager().itemExists(nodeEntry);
}
Also used : NodeEntry(org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry)

Example 23 with NodeEntry

use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.

the class JcrVersionManager method createConfiguration.

/**
     * @see javax.jcr.version.VersionManager#createConfiguration(String)
     */
public Node createConfiguration(String absPath) throws UnsupportedRepositoryOperationException, RepositoryException {
    session.checkIsAlive();
    NodeImpl n = (NodeImpl) itemManager.getNode(resolver.getQPath(absPath));
    NodeEntry entry = vMgr.createConfiguration((NodeState) n.getItemState());
    return (Node) itemManager.getItem(entry);
}
Also used : NodeEntry(org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry) Node(javax.jcr.Node)

Example 24 with NodeEntry

use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.

the class AccessControlManagerImpl method setPolicy.

public void setPolicy(String absPath, AccessControlPolicy policy) throws RepositoryException {
    checkValidNodePath(absPath);
    checkValidPolicy(policy);
    checkAcccessControlItem(absPath);
    SetTree operation;
    NodeState aclNode = getAclNode(absPath);
    if (aclNode == null) {
        // policy node doesn't exist at absPath -> create one.
        Name name = (absPath == null) ? N_REPO_POLICY : N_POLICY;
        NodeState parent = null;
        Name mixinType = null;
        if (absPath == null) {
            parent = getRootNodeState();
            mixinType = NT_REP_REPO_ACCESS_CONTROLLABLE;
        } else {
            parent = getNodeState(absPath);
            mixinType = NT_REP_ACCESS_CONTROLLABLE;
        }
        setMixin(parent, mixinType);
        operation = SetTree.create(itemStateMgr, parent, name, NT_REP_ACL, null);
        aclNode = operation.getTreeState();
    } else {
        Iterator<NodeEntry> it = getNodeEntry(aclNode).getNodeEntries();
        while (it.hasNext()) {
            it.next().transientRemove();
        }
        operation = SetTree.create(aclNode);
    }
    // create the entry nodes
    for (AccessControlEntry entry : ((AccessControlListImpl) policy).getAccessControlEntries()) {
        createAceNode(operation, aclNode, entry);
    }
    itemStateMgr.execute(operation);
}
Also used : NodeState(org.apache.jackrabbit.jcr2spi.state.NodeState) NodeEntry(org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry) SetTree(org.apache.jackrabbit.jcr2spi.operation.SetTree) AccessControlEntry(javax.jcr.security.AccessControlEntry) Name(org.apache.jackrabbit.spi.Name)

Example 25 with NodeEntry

use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.

the class Restore method persisted.

/**
     * In case of a workspace-restore or 'removeExisting' the complete tree gets
     * invalidated, otherwise the given <code>NodeState</code> that has been
     * updated and all its descendants.
     *
     * @see Operation#persisted()
     */
public void persisted() {
    assert status == STATUS_PENDING;
    status = STATUS_PERSISTED;
    NodeEntry entry;
    if (nodeState == null || removeExisting) {
        // invalidate the complete tree
        // -> start searching root-entry from any version-entry or
        //    from the given nodestate
        entry = (nodeState == null) ? versionStates[0].getNodeEntry() : nodeState.getNodeEntry();
        while (entry.getParent() != null) {
            entry = entry.getParent();
        }
    } else {
        entry = nodeState.getNodeEntry();
    }
    entry.invalidate(true);
}
Also used : NodeEntry(org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry)

Aggregations

NodeEntry (org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry)40 RepositoryException (javax.jcr.RepositoryException)13 PropertyEntry (org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry)10 ItemNotFoundException (javax.jcr.ItemNotFoundException)9 Name (org.apache.jackrabbit.spi.Name)9 Node (javax.jcr.Node)6 ItemExistsException (javax.jcr.ItemExistsException)5 NodeState (org.apache.jackrabbit.jcr2spi.state.NodeState)4 ArrayList (java.util.ArrayList)3 Version (javax.jcr.version.Version)3 NodeId (org.apache.jackrabbit.spi.NodeId)3 Path (org.apache.jackrabbit.spi.Path)3 PathNotFoundException (javax.jcr.PathNotFoundException)2 EffectiveNodeTypeProvider (org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider)2 PropertyState (org.apache.jackrabbit.jcr2spi.state.PropertyState)2 QPropertyDefinition (org.apache.jackrabbit.spi.QPropertyDefinition)2 QValue (org.apache.jackrabbit.spi.QValue)2 NameException (org.apache.jackrabbit.spi.commons.conversion.NameException)2 AccessDeniedException (javax.jcr.AccessDeniedException)1 Item (javax.jcr.Item)1