Package javax.jcr

Examples of javax.jcr.PropertyIterator


     * @return first node with a property of PropertType.REFERENCE
     */
    private Node locateNodeWithReference(Node node)
            throws RepositoryException {

        PropertyIterator properties = node.getProperties();
        while (properties.hasNext()) {
            Property p = properties.nextProperty();
            if (p.getType() == PropertyType.REFERENCE && !p.getDefinition().isMultiple()) {
                return node;
            }
        }

View Full Code Here


        super.setUp();

        session = helper.getReadOnlySession();
        testRootNode = session.getRootNode().getNode(testPath);

        PropertyIterator properties = testRootNode.getProperties();
        try {
            property = properties.nextProperty();
        } catch (NoSuchElementException e) {
            fail("Any node must have at least one property set: jcr:primaryType");
        }

    }
View Full Code Here

     * Tests if isSame() returns true when retrieving a property through
     * different sessions
     */
    public void testIsSame() throws RepositoryException {
        // access same property through different session
        PropertyIterator properties = testRootNode.getProperties();
        Property otherProperty = properties.nextProperty();
        assertTrue("isSame must return true for the same " +
                "property retrieved through different sessions.",
                property.isSame(otherProperty));
    }
View Full Code Here

     * Tests if <code>VersionHistory.getProperties()</code> and
     * <code>VersionHistory.getProperties(String)</code> return the right
     * property
     */
    public void testGetProperties() throws Exception {
        PropertyIterator pi = vHistory.getProperties();
        boolean hasPropertyUUID = false;
        while (pi.hasNext()) {
            if (pi.nextProperty().getName().equals(jcrUUID)) {
                hasPropertyUUID = true;
            }
        }
        assertTrue("VersionHistory.getProperties() does not return property jcr:UUID", hasPropertyUUID);

        pi = vHistory.getProperties(superuser.getNamespacePrefix(NS_JCR_URI) + ":*");
        hasPropertyUUID = false;
        while (pi.hasNext()) {
            if (pi.nextProperty().getName().equals(jcrUUID)) {
                hasPropertyUUID = true;
            }
        }
        assertTrue("VersionHistory.getProperties(String) does not return property jcr:UUID", hasPropertyUUID);
    }
View Full Code Here

    /**
     * Tests if <code>VersionHistory.getReferences()</code> returns the right
     * reference of the versionable node
     */
    public void testGetReferences() throws Exception {
        PropertyIterator pi = vHistory.getReferences();
        boolean hasNodeReference = false;
        while (pi.hasNext()) {
            Property p = pi.nextProperty();
            if (p.getName().equals(jcrVersionHistory) && superuser.getNodeByUUID(p.getString()).isSame(vHistory)) {
                hasNodeReference = true;
                break;
            }
        }
View Full Code Here

    /**
     * Tests if <code>Version.getProperties()</code> and
     * <code>Version.getProperties(String)</code> return the right property
     */
    public void testGetProperties() throws Exception {
        PropertyIterator pi = version.getProperties();
        boolean hasPropertyCreated = false;
        while (pi.hasNext()) {
            if (pi.nextProperty().getName().equals(jcrCreated)) {
                hasPropertyCreated = true;
            }
        }
        assertTrue("Version.getProperties() does not return property jcr:created", hasPropertyCreated);

        pi = version.getProperties(superuser.getNamespacePrefix(NS_JCR_URI) + ":*");
        hasPropertyCreated = false;
        while (pi.hasNext()) {
            if (pi.nextProperty().getName().equals(jcrCreated)) {
                hasPropertyCreated = true;
            }
        }
        assertTrue("Version.getProperties(String) does not return property jcr:created", hasPropertyCreated);
    }
View Full Code Here

        testRootNode.save();
        testNode.checkin();

        // check if reference is returned
        boolean nodeToBeReferencedIsReference = false;
        PropertyIterator propIter = nodeToBeReferenced.getReferences();
        while (propIter.hasNext()) {
            nodeToBeReferencedIsReference = true;
            fail("Reference found in version.");
            // not successful
        }
        // references in versions should not be found
View Full Code Here

     * node retrieved by property.getNode() is the same as the one retrieved by
     * session.getNodeByUUID() .
     */
    public void testPropValue() throws RepositoryException {
        Node referenced = session.getNodeByUUID(prop.getString());
        PropertyIterator referers = referenced.getReferences();
        if (!prop.isNew()) {
            boolean found = false;
            while (referers.hasNext()) {
                Property propp = referers.nextProperty();
                if (propp.isSame(prop)) {
                    found = true;
                }
            }
            assertTrue("Referencing property of node " + referenced.getName() +
View Full Code Here

                node.addMixin(mixin);
                modified = true;
            }

            // remove properties not in the set
            PropertyIterator pIter = node.getProperties();
            while (pIter.hasNext()) {
                Property p = pIter.nextProperty();
                String propName = p.getName();
                if (!PROTECTED_PROPERTIES.contains(propName)
                        && !ni.props.containsKey(propName)
                        && !saveProperties.contains(p.getPath())) {
                    try {
View Full Code Here

    /** Recursively outputs the contents of the given node. */
    private void dump(Node node) throws RepositoryException {

        // Then output the properties
        PropertyIterator properties = node.getProperties();
        Set set = new HashSet();
        while (properties.hasNext()) {
            Property property = properties.nextProperty();
            set.add(property.getName());
        }

        if (node.getPrimaryNodeType().getName().equals(ntFolder)) {
            assertTrue(hierarchyNodeProps.size() == set.size() && hierarchyNodeProps.containsAll(set));
View Full Code Here

TOP

Related Classes of javax.jcr.PropertyIterator

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.