Examples of NodeType


Examples of javax.jcr.nodetype.NodeType

                "Enter name for new node under:\n path: "+node.getJcrPath(), "", null);
        this.parentNodeType = node.getPrimaryType();
        this.ntManager = ntManager;
        if (ntManager!=null) {
            final LinkedList<String> ac = new LinkedList<String>(ntManager.getAllowedPrimaryChildNodeTypes(parentNodeType));
            final NodeType parentNt = ntManager.getNodeType(parentNodeType);
            allChildNodeDefs = parentNt.getChildNodeDefinitions();
            Collections.sort(ac);
            this.allowedChildren = ac;
        }
    }
View Full Code Here

Examples of javax.jcr.nodetype.NodeType

                    doNotAskAgain = true;
                }
            }

        }
        final NodeType nodeType = node.getNodeType();
        if (nodeType!=null && nodeType.getName()!=null && nodeType.getName().equals("nt:file")) {
            MessageDialog.openInformation(shell, "Cannot create node", "Node of type nt:file cannot have children");
            return;
        }
       
        try {
View Full Code Here

Examples of javax.jcr.nodetype.NodeType

                // NodeType.getDeclaredSupertypeNames();
                if (method.getName().equals("getSupertypes") && method.getParameterTypes().length == 0) {
                    NodeType[] superTypes = new NodeType[superTypeNames.length];
                    for (int i = 0; i < superTypeNames.length; i++) {
                        String aSuperTypeName = superTypeNames[i];
                        NodeType aSuperType = getNodeType(aSuperTypeName);
                        superTypes[i] = aSuperType;
                    }

                    return superTypes;
                }

                // Object.toString() , Object.hashCode(), Object.equals
                if (method.getDeclaringClass() == Object.class) {
                    if (method.getName().equals("toString") && method.getParameterTypes().length == 0) {
                        return proxy.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(proxy));
                    }

                    if (method.getName().equals("hashCode") && method.getParameterTypes().length == 0) {
                        return System.identityHashCode(proxy);
                    }

                    if (method.getName().equals("equals") && method.getParameterTypes().length == 1) {
                        return proxy == args[0];
                    }
                }

                return null;
            }
        };

        NodeType nodeType = (NodeType) Proxy.newProxyInstance(NodeType.class.getClassLoader(),
                new Class[] { NodeType.class }, ih);

        return nodeType;
    }
View Full Code Here

Examples of javax.jcr.nodetype.NodeType

        }
        return null;
    }

    public PropertyDefinition getPropertyDefinition(String propertyName) {
        NodeType nt0 = getNodeType();
        if (nt0==null) {
            return null;
        }
        List<NodeType> nodeTypes = new LinkedList<NodeType>();
        nodeTypes.add(nt0);
        // add all supertypes
        nodeTypes.addAll(Arrays.asList(nt0.getSupertypes()));
        for (Iterator<NodeType> it = nodeTypes.iterator(); it.hasNext();) {
            NodeType nt = it.next();
            PropertyDefinition[] pds = nt.getPropertyDefinitions();
            for (int i = 0; i < pds.length; i++) {
                PropertyDefinition propertyDefinition = pds[i];
                if (propertyDefinition.getName().equals(propertyName)) {
                    return propertyDefinition;
                }
View Full Code Here

Examples of javax.jcr.nodetype.NodeType

         if (this.isRoot())
         { // root - no parent
            if (nodeDefinition == null)
            {
               NodeType required =
                  nodeTypeManager.getNodeType(locationFactory.createJCRName(Constants.NT_BASE).getAsString());
               InternalQName requiredName = sysLocFactory.parseJCRName(required.getName()).getInternalName();
               NodeDefinitionData ntData =
                  new NodeDefinitionData(null, null, true, true, OnParentVersionAction.ABORT, false,
                     new InternalQName[]{requiredName}, null, true);
               this.nodeDefinition =
                  new NodeDefinitionImpl(ntData, nodeTypesHolder, nodeTypeManager, sysLocFactory,
View Full Code Here

Examples of javax.jcr.nodetype.NodeType

         if (this.isRoot())
         { // root - no parent
            if (nodeDefinition == null)
            {
               NodeType required =
                  nodeTypeManager.getNodeType(locationFactory.createJCRName(Constants.NT_BASE).getAsString());
               InternalQName requiredName = sysLocFactory.parseJCRName(required.getName()).getInternalName();
               NodeDefinitionData ntData =
                  new NodeDefinitionData(null, null, true, true, OnParentVersionAction.ABORT, false,
                     new InternalQName[]{requiredName}, null, true);
               this.nodeDefinition =
                  new NodeDefinitionImpl(ntData, nodeTypesHolder, nodeTypeManager, sysLocFactory,
View Full Code Here

Examples of javax.jcr.nodetype.NodeType

            fileNodeType = defaultFileNodeType;
         }

         String contentNodeType = NodeTypeUtil.getContentNodeType(contentNodeTypeHeader);
         NodeTypeManager ntm = session.getWorkspace().getNodeTypeManager();
         NodeType nodeType = ntm.getNodeType(contentNodeType);
         NodeTypeUtil.checkContentResourceType(nodeType);

         return new PutCommand(nullResourceLocks).put(session, path(repoPath), inputStream, fileNodeType,
            contentNodeType, NodeTypeUtil.getMixinTypes(mixinTypes), mimeType, encoding, updatePolicyType,
            autoVersionType, tokens);
View Full Code Here

Examples of javax.jcr.nodetype.NodeType

            log.debug("Node already has " + nodeTypeName + " as primary node type.");
            return;
        }

        NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
        NodeType nt = ntMgr.getNodeType(ntName);
        if (nt.isMixin()) {
            throw new ConstraintViolationException(nodeTypeName + ": not a primary node type.");
        } else if (nt.isAbstract()) {
            throw new ConstraintViolationException(nodeTypeName + ": is an abstract node type.");
        }

        // build effective node type of new primary type & existing mixin's
        // in order to detect conflicts
View Full Code Here

Examples of javax.jcr.nodetype.NodeType

        return false;
    }

    @Override
    public boolean canAddChildNode(String childNodeName, String nodeTypeName) {
        NodeType type;
        try {
            type = getManager().getNodeType(nodeTypeName);
            if (type.isAbstract()) {
                return false;
            }
        } catch (NoSuchNodeTypeException e) {
            return false;
        } catch (RepositoryException e) {
            log.warn("Unable to access node type " + nodeTypeName, e);
            return false;
        }
        // FIXME: properly calculate matching definition
        for (NodeDefinition definition : getChildNodeDefinitions()) {
            String name = definition.getName();
            if (matches(childNodeName, name) || RESIDUAL_NAME.equals(name)) {
                if (definition.isProtected()) {
                    return false;
                }
                for (String required : definition.getRequiredPrimaryTypeNames()) {
                    if (type.isNodeType(required)) {
                        return true;
                    }
                }
            }
        }
View Full Code Here

Examples of javax.jcr.nodetype.NodeType

    @Override
    public NodeTypeIterator getPrimaryNodeTypes() throws RepositoryException {
        List<NodeType> list = Lists.newArrayList();
        NodeTypeIterator iterator = getAllNodeTypes();
        while (iterator.hasNext()) {
            NodeType type = iterator.nextNodeType();
            if (!type.isMixin()) {
                list.add(type);
            }
        }
        return new NodeTypeIteratorAdapter(list);
    }
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.