use of javax.jcr.UnsupportedRepositoryOperationException in project jackrabbit by apache.
the class WorkspaceTest method testCreateWorkspaceFromSource.
public void testCreateWorkspaceFromSource() throws Exception {
Session s = null;
try {
Workspace wsp = superuser.getWorkspace();
String name = getNewWorkspaceName(wsp);
wsp.createWorkspace(name, wsp.getName());
List<String> wsps = Arrays.asList(wsp.getAccessibleWorkspaceNames());
assertTrue(wsps.contains(name));
s = getHelper().getSuperuserSession(name);
Workspace newW = s.getWorkspace();
assertEquals(name, newW.getName());
} catch (UnsupportedRepositoryOperationException e) {
throw new NotExecutableException();
} catch (UnsupportedOperationException e) {
throw new NotExecutableException();
} finally {
if (s != null) {
s.logout();
}
}
}
use of javax.jcr.UnsupportedRepositoryOperationException in project jackrabbit by apache.
the class VersionManagerImpl method merge.
/**
* {@inheritDoc}
*/
public NodeIterator merge(Node activityNode) throws RepositoryException {
NodeImpl actNode = (NodeImpl) activityNode;
if (!actNode.isNodeType(NameConstants.NT_ACTIVITY)) {
String msg = "Given node is not an activity: " + actNode.safeGetJCRPath();
log.error(msg);
throw new UnsupportedRepositoryOperationException(msg);
}
InternalActivity activity = vMgr.getActivity(actNode.getNodeId());
if (activity == null) {
String msg = "Given activity not found in version storage.";
log.error(msg);
throw new UnsupportedRepositoryOperationException(msg);
}
List<ItemId> failedIds = new ArrayList<ItemId>();
merge(activity, failedIds);
return new LazyItemIterator(context, failedIds);
}
use of javax.jcr.UnsupportedRepositoryOperationException in project jackrabbit by apache.
the class LifecycleTest method testGetAllowedLifecycleTransitions.
public void testGetAllowedLifecycleTransitions() throws RepositoryException, NotExecutableException {
Node node = superuser.getNode(path);
try {
String[] transitions = node.getAllowedLifecycleTransistions();
assertNotNull("Return value of getAllowedLifecycleTransitions is null", transitions);
for (int i = 0; i < transitions.length; i++) {
if (transition.equals(transitions[i])) {
return;
}
}
fail("Configured lifecycle transition \"" + transition + "\" is not among the allowed transitions from node " + path);
} catch (UnsupportedRepositoryOperationException e) {
fail("Unable to get allowed lifecycle transitions for node " + path + ": " + e.getMessage());
}
}
use of javax.jcr.UnsupportedRepositoryOperationException in project jackrabbit by apache.
the class NodeReadMethodsTest method testGetUUIDOfNonReferenceableNode.
/**
* Test if getUUID() throws a UnsupportedRepositoryOperationException if
* Node is not referenceable
*/
public void testGetUUIDOfNonReferenceableNode() throws NotExecutableException, RepositoryException {
// find a node NOT of type mix:referenceable
Node node = locateNonReferenceableNode(testRootNode);
if (node == null) {
throw new NotExecutableException("Workspace does not contain a non referenceable node");
}
try {
node.getUUID();
fail("UnsupportedRepositoryOperationException expected");
} catch (UnsupportedRepositoryOperationException e) {
// success
}
}
use of javax.jcr.UnsupportedRepositoryOperationException in project jackrabbit by apache.
the class NodeImpl method orderBefore.
/**
* @see Node#orderBefore(String, String)
*/
public synchronized void orderBefore(String srcChildRelPath, String destChildRelPath) throws UnsupportedRepositoryOperationException, VersionException, ConstraintViolationException, ItemNotFoundException, LockException, RepositoryException {
checkIsWritable();
if (!getPrimaryNodeType().hasOrderableChildNodes()) {
throw new UnsupportedRepositoryOperationException("Child node ordering not supported on node " + safeGetJCRPath());
}
// check arguments
if (srcChildRelPath.equals(destChildRelPath)) {
// there's nothing to do
return;
}
// check existence
if (!hasNode(srcChildRelPath)) {
throw new ItemNotFoundException("Node " + safeGetJCRPath() + " has no child node with name " + srcChildRelPath);
}
if (destChildRelPath != null && !hasNode(destChildRelPath)) {
throw new ItemNotFoundException("Node " + safeGetJCRPath() + " has no child node with name " + destChildRelPath);
}
Path srcPath = getReorderPath(srcChildRelPath);
Path beforePath = null;
if (destChildRelPath != null) {
beforePath = getReorderPath(destChildRelPath);
}
Operation op = ReorderNodes.create(getNodeState(), srcPath, beforePath);
session.getSessionItemStateManager().execute(op);
}
Aggregations