Package javax.jcr

Examples of javax.jcr.Session.itemExists()


        URL entry = bundle.getEntry(entryPath.concat("/"));
        if (entry != null) {
            Session session = resourceResolver.adaptTo(Session.class);
            if (session != null) {
                try {
                    if (session.itemExists(resourcePath)) {
                        return null;
                    }
                } catch (RepositoryException re) {
                    // don't care
                }
View Full Code Here


        // add node and save
        Node n1 = testRootNode.addNode(nodeName1, testNodeType);
        n1.addMixin(mixVersionable);
        testRootNode.save();

        if (!s2.itemExists(testRootNode.getPath())) {
            s2.getRootNode().addNode(testRootNode.getName());
            s2.save();
        }
        s2.getWorkspace().clone(s1.getWorkspace().getName(), n1.getPath(), n1.getPath(), true);
        Node n2 = (Node) s2.getItem(n1.getPath());
View Full Code Here

            // path -> the property must have the proper value.
            Property pp3 = (Property) s.getItem(sib2.getPath() + "/" + propertyName1);
            assertEquals("sib3-prop", pp3.getString());

            // the tree starting with node[3] must not be accessible any more.
            assertFalse(s.itemExists(p3.getPath()));
            assertFalse(s.itemExists(sib3.getPath()));
        } finally {
            s.logout();
        }
    }
View Full Code Here

            Property pp3 = (Property) s.getItem(sib2.getPath() + "/" + propertyName1);
            assertEquals("sib3-prop", pp3.getString());

            // the tree starting with node[3] must not be accessible any more.
            assertFalse(s.itemExists(p3.getPath()));
            assertFalse(s.itemExists(sib3.getPath()));
        } finally {
            s.logout();
        }
    }
View Full Code Here

        testSession.getNode(childNPath2);
        // ... and props of path
        assertTrue(n.getProperties().hasNext());

        //testSession must not have access to 'childNPath'
        assertFalse(testSession.itemExists(childNPath));
        try {
            testSession.getNode(childNPath);
            fail("Read access has been denied -> cannot retrieve child node.");
        } catch (PathNotFoundException e) {
            // ok.
View Full Code Here

            // ok.
        }
        /*
        -> must not have access to subtree below 'childNPath'
        */
        assertFalse(testSession.itemExists(childchildPPath));
        try {
            testSession.getItem(childchildPPath);
            fail("Read access has been denied -> cannot retrieve prop below child node.");
        } catch (PathNotFoundException e) {
            // ok.
View Full Code Here

        /*
         Testuser must still have READ-only access only and must not be
         allowed to view the acl-node that has been created.
        */
        assertFalse(testAcMgr.hasPrivileges(path, privilegesFromName(Privilege.JCR_READ_ACCESS_CONTROL)));
        assertFalse(testSession.itemExists(path + "/rep:policy"));

        Node n = testSession.getNode(tmpl.getPath());
        assertFalse(n.hasNode("rep:policy"));
        try {
            n.getNode("rep:policy");
View Full Code Here

        */

        // make sure the 'rep:policy' node has been created.
        assertTrue(superuser.itemExists(tmpl.getPath() + "/rep:policy"));
        // the policy node however must not be visible to the test-user
        assertFalse(testSession.itemExists(tmpl.getPath() + "/rep:policy"));
        try {
            testAcMgr.getPolicies(tmpl.getPath());
            fail("test user must not have READ_AC privilege.");
        } catch (AccessDeniedException e) {
            // success
View Full Code Here

        // test if login as testuser -> item at path must not exist.
        Session s = null;
        try {
            s = getHelper().getRepository().login(creds);
            assertFalse(s.itemExists(path));
        } finally {
            if (s != null) {
                s.logout();
            }
        }
View Full Code Here

     */
    public void removeMember(DavResource member) throws DavException {
        Session session = getRepositorySession();
        try {
            String itemPath = member.getLocator().getRepositoryPath();
            if (!exists() || !session.itemExists(itemPath)) {
                throw new DavException(DavServletResponse.SC_NOT_FOUND);
            }
            if (!getResourcePath().equals(Text.getRelativeParent(member.getResourcePath(), 1))) {
                throw new DavException(DavServletResponse.SC_CONFLICT, member.getResourcePath() + "is not member of this resource (" + getResourcePath() + ")");
            }
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.