Package javax.jcr

Examples of javax.jcr.Item


     */
    public void testIsSame() throws RepositoryException {
        // access same node through different session
        Session s = helper.getReadOnlySession();
        try {
            Item otherTestNode = s.getRootNode().getNode(testPath);
            assertTrue("isSame(Item item) must return true for the same " +
                    "item retrieved through different sessions.",
                    testRootNode.isSame(otherTestNode));
        } finally {
            s.logout();
View Full Code Here


     * Test if all returned items are of type node.
     */
    public void testGetNodes() throws RepositoryException {
        NodeIterator nodes = testRootNode.getNodes();
        while (nodes.hasNext()) {
            Item item = (Item) nodes.next();
            assertTrue("Item is not a node", item.isNode());
        }
    }
View Full Code Here

     * Test if all returned items are of type node.
     */
    public void testGetProperties() throws RepositoryException {
        PropertyIterator properties = testRootNode.getProperties();
        while (properties.hasNext()) {
            Item item = (Item) properties.next();
            assertFalse("Item is not a property", item.isNode());
        }
    }
View Full Code Here

            throw new NotExecutableException("Workspace does not contain a node with primary item defined");
        }

        String primaryItemName = node.getPrimaryNodeType().getPrimaryItemName();

        Item primaryItem = node.getPrimaryItem();
        if (primaryItem.isNode()) {
            assertTrue("Node returned by getPrimaryItem() is not the same as " +
                    "the one aquired by getNode(String)",
                    node.getNode(primaryItemName).isSame(primaryItem));
        } else {
            assertTrue("Property returned by getPrimaryItem() is not the same as " +
View Full Code Here

            throws PathNotFoundException, ConstraintViolationException,
            VersionException, LockException, RepositoryException {
        // check sanity of this session
        sanityCheck();

        Item item;
        try {
            Path p = PathFormat.parse(parentAbsPath, getNamespaceResolver()).getNormalizedPath();
            if (!p.isAbsolute()) {
                throw new RepositoryException("not an absolute path: " + parentAbsPath);
            }
            item = getItemManager().getItem(p);
        } catch (MalformedPathException mpe) {
            String msg = parentAbsPath + ": invalid path";
            log.debug(msg);
            throw new RepositoryException(msg, mpe);
        } catch (AccessDeniedException ade) {
            throw new PathNotFoundException(parentAbsPath);
        }
        if (!item.isNode()) {
            throw new PathNotFoundException(parentAbsPath);
        }
        NodeImpl parent = (NodeImpl) item;

        // verify that parent node is checked-out
View Full Code Here

                                   boolean skipBinary, boolean noRecurse)
            throws PathNotFoundException, SAXException, RepositoryException {
        // check sanity of this session
        sanityCheck();

        Item item = getItem(absPath);
        if (!item.isNode()) {
            // there's a property, though not a node at the specified path
            throw new PathNotFoundException(absPath);
        }
        new DocViewSAXEventGenerator((Node) item, noRecurse, skipBinary,
                contentHandler).serialize();
View Full Code Here

                                 boolean skipBinary, boolean noRecurse)
            throws PathNotFoundException, SAXException, RepositoryException {
        // check sanity of this session
        sanityCheck();

        Item item = getItem(absPath);
        if (!item.isNode()) {
            // there's a property, though not a node at the specified path
            throw new PathNotFoundException(absPath);
        }
        new SysViewSAXEventGenerator((Node) item, noRecurse, skipBinary,
                contentHandler).serialize();
View Full Code Here

        }


        try {
            String itemPath = member.getLocator().getRepositoryPath();
            Item memItem = getJcrSession().getItem(itemPath);
            if (memItem instanceof Node) {
                ((Node)memItem).removeShare();
            } else {
                memItem.remove();
            }
            getJcrSession().save();

            // make sure, non-jcr locks are removed, once the removal is completed
            try {
View Full Code Here

        // Assert added nodes are visible in session 1 after refresh
        node1.refresh(false);
        assertTrue(readOnly.itemExists(n2.getPath()));
        assertTrue(readOnly.itemExists(p3.getPath()));

        Item m2 = readOnly.getItem(n2.getPath());
        assertTrue(m2.isNode());
        assertTrue(((Node) m2).hasProperty(propertyName1));

        // Remove property through session 2
        p3.remove();
        testRootNode.save();
View Full Code Here

        // Assert added nodes are visible in session 1 after refresh
        node1.refresh(false);
        assertTrue(readOnly.itemExists(n2.getPath()));
        assertTrue(readOnly.itemExists(p3.getPath()));

        Item q3 = readOnly.getItem(p3.getPath());
        assertFalse(q3.isNode());
        assertTrue("v3".equals(((Property) q3).getString()));

        // Change property value through session 2
        p3.setValue("v3_modified");
        testRootNode.save();
View Full Code Here

TOP

Related Classes of javax.jcr.Item

Copyright © 2018 www.massapicom. 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.