Package org.apache.jackrabbit.oak.api

Examples of org.apache.jackrabbit.oak.api.Tree.removeProperty()


    @Test
    public void removeAuthorizableId() throws Exception {
        try {
            Tree userTree = root.getTree(userPath);
            userTree.removeProperty(REP_AUTHORIZABLE_ID);
            root.commit();
            fail("removing authorizable id should fail");
        } catch (CommitFailedException e) {
            // expected
        } finally {
View Full Code Here


    @Test
    public void createWithoutPrincipalName() throws Exception {
        try {
            User user = getUserManager(root).createUser("withoutPrincipalName", "pw");
            Tree tree = root.getTree(userPath);
            tree.removeProperty(REP_PRINCIPAL_NAME);
            root.commit();

            fail("creating user with invalid jcr:uuid should fail");
        } catch (CommitFailedException e) {
            // expected
View Full Code Here

        } else if (!tree.hasProperty(JCR_LOCKISDEEP)) {
            throw new LockException("Node " + path + " is not locked");
        }

        try {
            tree.removeProperty(JCR_LOCKISDEEP);
            tree.removeProperty(JCR_LOCKOWNER);
            sessionDelegate.commit(root);
        } catch (CommitFailedException e) {
            if (e.isAccessViolation()) {
                throw new AccessControlException(
View Full Code Here

            throw new LockException("Node " + path + " is not locked");
        }

        try {
            tree.removeProperty(JCR_LOCKISDEEP);
            tree.removeProperty(JCR_LOCKOWNER);
            sessionDelegate.commit(root);
        } catch (CommitFailedException e) {
            if (e.isAccessViolation()) {
                throw new AccessControlException(
                        "Access denied to unlock node " + path, e);
View Full Code Here

            // remove existing mapping to given URI
            for (PropertyState mapping : namespaces.getProperties()) {
                if (mapping.getType() == STRING
                        && uri.equals(mapping.getValue(STRING))) {
                    namespaces.removeProperty(mapping.getName());
                }
            }

            // add this mapping (overrides existing mapping with same prefix)
            namespaces.setProperty(prefix, uri);
View Full Code Here

                    "Namespace mapping from " + prefix + " to "
                            + getURI(prefix) + " can not be unregistered");
        }

        try {
            namespaces.removeProperty(prefix);
            root.commit();
            refresh();
        } catch (CommitFailedException e) {
            String message = "Failed to unregister namespace mapping for prefix " + prefix;
            throw e.asRepositoryException(message);
View Full Code Here

        if (superTypeOakNames.length > 0) {
            type.setProperty(
                    JCR_SUPERTYPES,
                    Arrays.asList(superTypeOakNames), Type.NAMES);
        } else {
            type.removeProperty(JCR_SUPERTYPES);
        }

        type.setProperty(JCR_IS_ABSTRACT, isAbstract);
        type.setProperty(JCR_IS_QUERYABLE, queryable);
        type.setProperty(JCR_ISMIXIN, isMixin);
View Full Code Here

        // TODO fail (in validator?) if a supertype specifies a different primary item
        // See 3.7.6.7 Node Type Attribute Subtyping Rules (OAK-411)
        if (primaryItemOakName != null) {
            type.setProperty(JCR_PRIMARYITEMNAME, primaryItemOakName, Type.NAME);
        } else {
            type.removeProperty(JCR_PRIMARYITEMNAME);
        }

        Tree tree;
        // TODO fail (in validator?) on invalid item definitions
        // See 3.7.6.8 Item Definitions in Subtypes (OAK-411)
View Full Code Here

        tree.setProperty("new", "value2");
        assertEquals(Tree.Status.MODIFIED, tree.getPropertyStatus("new"));
        root.commit();

        assertEquals(Tree.Status.UNCHANGED, tree.getPropertyStatus("new"));
        tree.removeProperty("new");
        assertNull(tree.getPropertyStatus("new"));
        root.commit();

        assertNull(tree.getPropertyStatus("new"));
View Full Code Here

        setupPermission("/a", testPrincipal, true, PrivilegeConstants.JCR_READ);

        try {
            Root testRoot = getTestRoot();
            Tree test = testRoot.getTree(referenceablePath);
            test.removeProperty(JCR_UUID);
            testRoot.commit();
            fail("Removing the jcr:uuid property of a referenceable node must fail.");
        } catch (CommitFailedException e) {
            assertTrue(e.isConstraintViolation());
            assertEquals(22, e.getCode());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.