Package javax.jcr.nodetype

Examples of javax.jcr.nodetype.NodeTypeIterator


     */
    public Query create(Selector selector) throws RepositoryException {
        List<Term> terms = new ArrayList<Term>();

        String name = selector.getNodeTypeName();
        NodeTypeIterator allTypes = ntManager.getAllNodeTypes();
        while (allTypes.hasNext()) {
            NodeType nt = allTypes.nextNodeType();
            if (nt.isNodeType(name)) {
                terms.add(createNodeTypeTerm(nt));
            }
        }

View Full Code Here


            StringWriter writer = new StringWriter();
            try {
                Session s = getRepositorySession();

                CompactNodeTypeDefWriter cndWriter = new CompactNodeTypeDefWriter(writer, s, true);
                NodeTypeIterator ntIterator = s.getWorkspace().getNodeTypeManager().getAllNodeTypes();
                while (ntIterator.hasNext()) {
                    cndWriter.write(ntIterator.nextNodeType());
                }
                cndWriter.close();
                /*
                NOTE: avoid having JCR_NODETYPES_CND exposed upon allprop
                      PROPFIND request since it needs to be calculated.
View Full Code Here

     * Test if isMixin() returns false if applied on a primary node type and true
     * on a mixin node type.
     */
    public void testIsMixin() throws RepositoryException {

        NodeTypeIterator primaryTypes = manager.getPrimaryNodeTypes();
        assertFalse("testIsMixin() must return false if applied on a " +
                "primary node type",
                primaryTypes.nextNodeType().isMixin());

        // if a mixin node type exist, test if isMixin() returns true
        NodeTypeIterator mixinTypes = manager.getMixinNodeTypes();
        if (getSize(mixinTypes) > 0) {
            // need to re-aquire iterator {@link #getSize} may consume iterator
            mixinTypes = manager.getMixinNodeTypes();
            assertTrue("testIsMixin() must return true if applied on a " +
                    "mixin node type",
                    mixinTypes.nextNodeType().isMixin());
        }
        // else skip the test for mixin node types
    }
View Full Code Here

     */
    public void testGetSupertypes()
            throws NotExecutableException, RepositoryException {

        // find a primary node type but not "nt:base"
        NodeTypeIterator types = manager.getPrimaryNodeTypes();
        NodeType type = null;
        while (types.hasNext()) {
            type = types.nextNodeType();
            if (!type.getName().equals(ntBase)) {
                break;
            }
        }

View Full Code Here

     * returned by getSupertypes(). All existing node types are tested.
     */
    public void testGetDeclaredSupertypes()
            throws RepositoryException {

        NodeTypeIterator types = manager.getAllNodeTypes();
        while (types.hasNext()) {
            NodeType type = types.nextNodeType();

            NodeType declaredSupertypes[] = type.getDeclaredSupertypes();
            NodeType supertypes[] = type.getSupertypes();

            try {
View Full Code Here

     */
    public void testIsNodeType()
            throws RepositoryException {

        // find a primary node type but not "nt:base"
        NodeTypeIterator types = manager.getPrimaryNodeTypes();
        while (types.hasNext()) {
            NodeType type = types.nextNodeType();
            assertTrue("isNodeType(String nodeTypeName) must return true if " +
                    "NodeType is nodeTypeName",
                    type.isNodeType(type.getName()));
            if (type.isMixin()) {
                assertFalse("isNodeType(String nodeTypeName) must return " +
View Full Code Here

     * returned by getPropertyDefs(). All existing node types are tested.
     */
    public void testGetDeclaredPropertyDefs()
            throws RepositoryException {

        NodeTypeIterator types = manager.getAllNodeTypes();
        while (types.hasNext()) {
            NodeType type = types.nextNodeType();

            PropertyDefinition declaredDefs[] = type.getDeclaredPropertyDefinitions();
            PropertyDefinition defs[] = type.getPropertyDefinitions();

            try {
View Full Code Here

     */
    public void testGetPropertyDefs()
            throws NotExecutableException, RepositoryException {

        // find a primary node type but not "nt:base"
        NodeTypeIterator types = manager.getPrimaryNodeTypes();
        while (types.hasNext()) {
            NodeType type = types.nextNodeType();
            PropertyDefinition defs[] = type.getPropertyDefinitions();
            boolean hasJCRPrimaryType = false;
            for (int i = 0; i < defs.length; i++) {
                if (defs[i].getName().equals(jcrPrimaryType)) {
                    hasJCRPrimaryType = true;
View Full Code Here

     * returned by getChildNodeDefs(). All existing node types are tested.
     */
    public void testGetDeclaredChildNodeDefs()
            throws RepositoryException {

        NodeTypeIterator types = manager.getAllNodeTypes();
        while (types.hasNext()) {
            NodeType type = types.nextNodeType();

            NodeDefinition declaredDefs[] = type.getDeclaredChildNodeDefinitions();
            NodeDefinition defs[] = type.getChildNodeDefinitions();

            try {
View Full Code Here

     * Test getDeclaringNodeType() returns the node type which is defining the
     * requested property def. Test runs for all existing node types.
     */
    public void testGetDeclaringNodeType() throws RepositoryException {

        NodeTypeIterator types = manager.getAllNodeTypes();
        // loop all node types
        while (types.hasNext()) {
            NodeType currentType = types.nextNodeType();
            PropertyDefinition defsOfCurrentType[] =
                    currentType.getPropertyDefinitions();

            // loop all property defs of each node type
            for (int i = 0; i < defsOfCurrentType.length; i++) {
View Full Code Here

TOP

Related Classes of javax.jcr.nodetype.NodeTypeIterator

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.