Search in sources :

Example 11 with NodeState

use of org.apache.jackrabbit.jcr2spi.state.NodeState in project jackrabbit by apache.

the class AccessControlManagerImpl method addNode.

private NodeState addNode(SetTree treeOperation, NodeState parent, Name nodeName, String uuid, Name nodeTypeName) throws RepositoryException {
    Operation sp = treeOperation.addChildNode(parent, nodeName, nodeTypeName, uuid);
    itemStateMgr.execute(sp);
    return (NodeState) ((AddNode) sp).getAddedStates().get(0);
}
Also used : NodeState(org.apache.jackrabbit.jcr2spi.state.NodeState) Operation(org.apache.jackrabbit.jcr2spi.operation.Operation) AddNode(org.apache.jackrabbit.jcr2spi.operation.AddNode)

Example 12 with NodeState

use of org.apache.jackrabbit.jcr2spi.state.NodeState in project jackrabbit by apache.

the class AccessControlManagerImpl method checkAcccessControlItem.

/**
     * Checks whether if the given nodePath points to an access
     * control policy or entry node.
     * @param nodePath
     * @throws AccessControlException
     * @throws RepositoryException
     */
private void checkAcccessControlItem(String nodePath) throws AccessControlException, RepositoryException {
    NodeState controlledState = getNodeState(nodePath);
    Name ntName = controlledState.getNodeTypeName();
    boolean isAcItem = ntName.equals(NT_REP_ACL) || ntName.equals(NT_REP_GRANT_ACE) || ntName.equals(NT_REP_DENY_ACE);
    if (isAcItem) {
        throw new AccessControlException("The path: " + nodePath + " points to an access control content node");
    }
}
Also used : NodeState(org.apache.jackrabbit.jcr2spi.state.NodeState) AccessControlException(javax.jcr.security.AccessControlException) Name(org.apache.jackrabbit.spi.Name)

Example 13 with NodeState

use of org.apache.jackrabbit.jcr2spi.state.NodeState in project jackrabbit by apache.

the class VersionHistoryImpl method removeVersion.

/**
     * @see VersionHistory#removeVersion(String)
     */
public void removeVersion(String versionName) throws ReferentialIntegrityException, AccessDeniedException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
    checkStatus();
    NodeState vState = getVersionState(versionName);
    session.getVersionStateManager().removeVersion((NodeState) getItemState(), vState);
}
Also used : NodeState(org.apache.jackrabbit.jcr2spi.state.NodeState)

Example 14 with NodeState

use of org.apache.jackrabbit.jcr2spi.state.NodeState in project jackrabbit by apache.

the class VersionHistoryImpl method getVersion.

/**
     * @see VersionHistory#getVersion(String)
     */
public Version getVersion(String versionName) throws VersionException, RepositoryException {
    checkStatus();
    NodeState vState = getVersionState(versionName);
    return (Version) getItemManager().getItem(vState.getHierarchyEntry());
}
Also used : NodeState(org.apache.jackrabbit.jcr2spi.state.NodeState) Version(javax.jcr.version.Version)

Example 15 with NodeState

use of org.apache.jackrabbit.jcr2spi.state.NodeState in project jackrabbit by apache.

the class VersionHistoryImpl method removeVersionLabel.

/**
     * @see VersionHistory#removeVersionLabel(String)
     */
public void removeVersionLabel(String label) throws VersionException, RepositoryException {
    checkStatus();
    Name qLabel = getQLabel(label);
    Version version = getVersionByLabel(qLabel);
    NodeState vState = getVersionState(version.getName());
    // delegate to version manager that operates on workspace directly
    session.getVersionStateManager().removeVersionLabel((NodeState) getItemState(), vState, qLabel);
}
Also used : NodeState(org.apache.jackrabbit.jcr2spi.state.NodeState) Version(javax.jcr.version.Version) Name(org.apache.jackrabbit.spi.Name)

Aggregations

NodeState (org.apache.jackrabbit.jcr2spi.state.NodeState)31 Name (org.apache.jackrabbit.spi.Name)8 ItemNotFoundException (javax.jcr.ItemNotFoundException)5 RepositoryException (javax.jcr.RepositoryException)5 PropertyState (org.apache.jackrabbit.jcr2spi.state.PropertyState)5 Path (org.apache.jackrabbit.spi.Path)5 NodeEntry (org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry)4 ItemExistsException (javax.jcr.ItemExistsException)3 Operation (org.apache.jackrabbit.jcr2spi.operation.Operation)3 NodeId (org.apache.jackrabbit.spi.NodeId)3 Item (javax.jcr.Item)2 ConstraintViolationException (javax.jcr.nodetype.ConstraintViolationException)2 AccessControlException (javax.jcr.security.AccessControlException)2 Privilege (javax.jcr.security.Privilege)2 Version (javax.jcr.version.Version)2 VersionException (javax.jcr.version.VersionException)2 AddNode (org.apache.jackrabbit.jcr2spi.operation.AddNode)2 QNodeDefinition (org.apache.jackrabbit.spi.QNodeDefinition)2 QValue (org.apache.jackrabbit.spi.QValue)2 ArrayList (java.util.ArrayList)1