use of org.apache.jackrabbit.jcr2spi.operation.Operation in project jackrabbit by apache.
the class AccessControlManagerImpl method addProperty.
private void addProperty(SetTree treeOperation, NodeState parent, Name propName, int propType, QValue[] values) throws RepositoryException {
QPropertyDefinition definition = definitionProvider.getQPropertyDefinition(parent.getAllNodeTypeNames(), propName, propType);
Operation ap = treeOperation.addChildProperty(parent, propName, propType, values, definition);
itemStateMgr.execute(ap);
}
use of org.apache.jackrabbit.jcr2spi.operation.Operation in project jackrabbit by apache.
the class WorkspaceImpl method copy.
/**
* @see javax.jcr.Workspace#copy(String, String, String)
*/
public void copy(String srcWorkspace, String srcAbsPath, String destAbsPath) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
session.checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
session.checkIsAlive();
// check workspace name
if (getName().equals(srcWorkspace)) {
// same as current workspace, delegate to within workspace copy method
copy(srcAbsPath, destAbsPath);
return;
}
// make sure the specified workspace is visible for the current session.
session.checkAccessibleWorkspace(srcWorkspace);
Path srcPath = session.getQPath(srcAbsPath);
Path destPath = session.getQPath(destAbsPath);
// copy (i.e. pull) subtree at srcAbsPath from srcWorkspace
// to 'this' workspace at destAbsPath
SessionImpl srcSession = null;
try {
// create session on other workspace for current subject
// (may throw NoSuchWorkspaceException and AccessDeniedException)
srcSession = session.switchWorkspace(srcWorkspace);
WorkspaceImpl srcWsp = (WorkspaceImpl) srcSession.getWorkspace();
// do cross-workspace copy
Operation op = Copy.create(srcPath, destPath, srcWsp.getName(), srcWsp, this);
getUpdatableItemStateManager().execute(op);
} finally {
if (srcSession != null) {
// we don't need the other session anymore, logout
srcSession.logout();
}
}
}
Aggregations