use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class ItemImpl method getParent.
/**
* @see Item#getParent()
*/
public Node getParent() throws ItemNotFoundException, AccessDeniedException, RepositoryException {
checkStatus();
// special treatment for root node
if (state.isNode() && ((NodeState) state).isRoot()) {
String msg = "Root node doesn't have a parent.";
log.debug(msg);
throw new ItemNotFoundException(msg);
}
NodeEntry parentEntry = getItemState().getHierarchyEntry().getParent();
return (Node) getItemManager().getItem(parentEntry);
}
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();
}
}
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);
}
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);
}
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);
}
Aggregations