/** * {@inheritDoc} */ public boolean isAbstract() { return ntd.isAbstract(); }
/** * {@inheritDoc} */ public boolean isAbstract() { return ntd.isAbstract(); }
/** * @see javax.jcr.nodetype.NodeTypeDefinition#isAbstract() */ public boolean isAbstract() { return ntd.isAbstract(); }
/** * @return <code>true</code> if abstract flag diff */ public int abstractFlagDiff() { return oldDef.isAbstract() && !newDef.isAbstract() ? MAJOR : NONE; }
/** * @see javax.jcr.nodetype.NodeTypeDefinition#isAbstract() */ public boolean isAbstract() { return ntd.isAbstract(); }
/** * @return <code>true</code> if abstract flag diff */ public int abstractFlagDiff() { return oldDef.isAbstract() && !newDef.isAbstract() ? MAJOR : NONE; }
/** * Returns <code>true</code> if this is an abstract node type; returns * <code>false</code> otherwise. * <p> * An abstract node type is one that cannot be assigned as the primary or * mixin type of a node but can be used in the definitions of other node * types as a superclass. * <p> * In implementations that support node type registration, if this * <code>NodeTypeDefinition</code> object is actually a newly-created empty * <code>NodeTypeTemplate</code>, then this method will return * <code>false</code>. * * @return a <code>boolean</code> * @since JCR 2.0 */ public boolean isAbstract() { return ntd.isAbstract(); }
/** * Returns <code>true</code> if this is an abstract node type; returns * <code>false</code> otherwise. * <p> * An abstract node type is one that cannot be assigned as the primary or * mixin type of a node but can be used in the definitions of other node * types as a superclass. * <p> * In implementations that support node type registration, if this * <code>NodeTypeDefinition</code> object is actually a newly-created empty * <code>NodeTypeTemplate</code>, then this method will return * <code>false</code>. * * @return a <code>boolean</code> * @since JCR 2.0 */ public boolean isAbstract() { return ntd.isAbstract(); }
supertypes.toArray(new Name[supertypes.size()]), ntd.getSupportedMixinTypes(), ntd.isMixin(), ntd.isAbstract(), ntd.isQueryable(), ntd.hasOrderableChildNodes(), ntd.getPrimaryItemName(), ntd.getPropertyDefs(), ntd.getChildNodeDefs());
private NodeTypeTemplate createNodeTypeTemplate(ValueFactory valueFactory, NodeTypeManager ntMgr, String oakName, QNodeTypeDefinition def) throws RepositoryException { NodeTypeTemplate tmpl = ntMgr.createNodeTypeTemplate(); tmpl.setName(oakName); tmpl.setAbstract(def.isAbstract()); tmpl.setMixin(def.isMixin()); tmpl.setOrderableChildNodes(def.hasOrderableChildNodes());
/** * Copy constructor. * * @param nt the node type definition. */ public QNodeTypeDefinitionImpl(QNodeTypeDefinition nt) { this(nt.getName(), nt.getSupertypes(), nt.getSupportedMixinTypes(), nt.isMixin(), nt.isAbstract(), nt.isQueryable(), nt.hasOrderableChildNodes(), nt.getPrimaryItemName(), nt.getPropertyDefs(), nt.getChildNodeDefs()); }
ntdOld.getSupertypes(), ntd.getSupportedMixinTypes(), ntd.isMixin(), ntd.isAbstract(), ntd.isQueryable(), ntd.hasOrderableChildNodes(), ntd.getPrimaryItemName(), ntd.getPropertyDefs(), ntd.getChildNodeDefs());
/** * Copy constructor. * * @param nt the node type definition. */ public QNodeTypeDefinitionImpl(QNodeTypeDefinition nt) { this(nt.getName(), nt.getSupertypes(), nt.getSupportedMixinTypes(), nt.isMixin(), nt.isAbstract(), nt.isQueryable(), nt.hasOrderableChildNodes(), nt.getPrimaryItemName(), nt.getPropertyDefs(), nt.getChildNodeDefs()); }
private NodeTypeTemplate createNodeTypeTemplate(ValueFactory valueFactory, NodeTypeManager ntMgr, String oakName, QNodeTypeDefinition def) throws RepositoryException { NodeTypeTemplate tmpl = ntMgr.createNodeTypeTemplate(); tmpl.setName(oakName); tmpl.setAbstract(def.isAbstract()); tmpl.setMixin(def.isMixin()); tmpl.setOrderableChildNodes(def.hasOrderableChildNodes());
/** * @param name * @param nodeTypeName * @param ntReg * @throws ConstraintViolationException * @throws NoSuchNodeTypeException */ public void checkAddNodeConstraints(Name name, Name nodeTypeName, NodeTypeRegistry ntReg) throws ConstraintViolationException, NoSuchNodeTypeException { if (nodeTypeName != null) { QNodeTypeDefinition ntDef = ntReg.getNodeTypeDef(nodeTypeName); if (ntDef.isAbstract()) { throw new ConstraintViolationException(nodeTypeName + " is abstract."); } if (ntDef.isMixin()) { throw new ConstraintViolationException(nodeTypeName + " is mixin."); } } QItemDefinition nd = getApplicableChildNodeDef(name, nodeTypeName, ntReg); if (nd.isProtected()) { throw new ConstraintViolationException(name + " is protected"); } if (nd.isAutoCreated()) { throw new ConstraintViolationException(name + " is auto-created and can not be manually added"); } }
/** * @param name * @param nodeTypeName * @param ntReg * @throws ConstraintViolationException * @throws NoSuchNodeTypeException */ public void checkAddNodeConstraints(Name name, Name nodeTypeName, NodeTypeRegistry ntReg) throws ConstraintViolationException, NoSuchNodeTypeException { if (nodeTypeName != null) { QNodeTypeDefinition ntDef = ntReg.getNodeTypeDef(nodeTypeName); if (ntDef.isAbstract()) { throw new ConstraintViolationException(nodeTypeName + " is abstract."); } if (ntDef.isMixin()) { throw new ConstraintViolationException(nodeTypeName + " is mixin."); } } QItemDefinition nd = getApplicableChildNodeDef(name, nodeTypeName, ntReg); if (nd.isProtected()) { throw new ConstraintViolationException(name + " is protected"); } if (nd.isAutoCreated()) { throw new ConstraintViolationException(name + " is auto-created and can not be manually added"); } }
/** * @see EffectiveNodeType#checkAddNodeConstraints(org.apache.jackrabbit.spi.Name,QNodeTypeDefinition, ItemDefinitionProvider) */ public void checkAddNodeConstraints(Name name, QNodeTypeDefinition nodeTypeDefinition, ItemDefinitionProvider definitionProvider) throws ConstraintViolationException, NoSuchNodeTypeException { if (nodeTypeDefinition.isAbstract()) { throw new ConstraintViolationException("not allowed to add node " + name + ": " + nodeTypeDefinition.getName() + " is abstract and cannot be used as primary node type."); } if (nodeTypeDefinition.isMixin()) { throw new ConstraintViolationException("not allowed to add node " + name + ":" + nodeTypeDefinition.getName() + " is a mixin and cannot be used as primary node type."); } QNodeDefinition nd = definitionProvider.getQNodeDefinition(this, name, nodeTypeDefinition.getName()); if (nd.isProtected()) { throw new ConstraintViolationException(name + " is protected."); } if (nd.isAutoCreated()) { throw new ConstraintViolationException(name + " is auto-created and can not be manually added"); } }
/** * @see EffectiveNodeType#checkAddNodeConstraints(org.apache.jackrabbit.spi.Name,QNodeTypeDefinition, ItemDefinitionProvider) */ public void checkAddNodeConstraints(Name name, QNodeTypeDefinition nodeTypeDefinition, ItemDefinitionProvider definitionProvider) throws ConstraintViolationException, NoSuchNodeTypeException { if (nodeTypeDefinition.isAbstract()) { throw new ConstraintViolationException("not allowed to add node " + name + ": " + nodeTypeDefinition.getName() + " is abstract and cannot be used as primary node type."); } if (nodeTypeDefinition.isMixin()) { throw new ConstraintViolationException("not allowed to add node " + name + ":" + nodeTypeDefinition.getName() + " is a mixin and cannot be used as primary node type."); } QNodeDefinition nd = definitionProvider.getQNodeDefinition(this, name, nodeTypeDefinition.getName()); if (nd.isProtected()) { throw new ConstraintViolationException(name + " is protected."); } if (nd.isAutoCreated()) { throw new ConstraintViolationException(name + " is auto-created and can not be manually added"); } }
/** * Create a new JCR node type definition from the given * <code>QNodeTypeDefinition</code>. * * @param qNtd A SPI node type definition. * @return the corresponding JCR node type definition. * @throws RepositoryException if an error occurs. */ @SuppressWarnings("unchecked") public NodeTypeDefinition create(QNodeTypeDefinition qNtd) throws RepositoryException { NodeTypeTemplate nt = ntMgr.createNodeTypeTemplate(); nt.setName(getJCRName(qNtd.getName())); nt.setDeclaredSuperTypeNames(getJCRNames(qNtd.getSupertypes())); nt.setAbstract(qNtd.isAbstract()); nt.setMixin(qNtd.isMixin()); nt.setOrderableChildNodes(qNtd.hasOrderableChildNodes()); nt.setPrimaryItemName(getJCRName(qNtd.getPrimaryItemName())); nt.setQueryable(qNtd.isQueryable()); List nodeDefs = nt.getNodeDefinitionTemplates(); for (QNodeDefinition qNd: qNtd.getChildNodeDefs()) { nodeDefs.add(create(qNd)); } List propDefs = nt.getPropertyDefinitionTemplates(); for (QPropertyDefinition qPd: qNtd.getPropertyDefs()) { propDefs.add(create(qPd)); } return nt; }
/** * Create a new JCR node type definition from the given * <code>QNodeTypeDefinition</code>. * * @param qNtd A SPI node type definition. * @return the corresponding JCR node type definition. * @throws RepositoryException if an error occurs. */ @SuppressWarnings("unchecked") public NodeTypeDefinition create(QNodeTypeDefinition qNtd) throws RepositoryException { NodeTypeTemplate nt = ntMgr.createNodeTypeTemplate(); nt.setName(getJCRName(qNtd.getName())); nt.setDeclaredSuperTypeNames(getJCRNames(qNtd.getSupertypes())); nt.setAbstract(qNtd.isAbstract()); nt.setMixin(qNtd.isMixin()); nt.setOrderableChildNodes(qNtd.hasOrderableChildNodes()); nt.setPrimaryItemName(getJCRName(qNtd.getPrimaryItemName())); nt.setQueryable(qNtd.isQueryable()); List nodeDefs = nt.getNodeDefinitionTemplates(); for (QNodeDefinition qNd: qNtd.getChildNodeDefs()) { nodeDefs.add(create(qNd)); } List propDefs = nt.getPropertyDefinitionTemplates(); for (QPropertyDefinition qPd: qNtd.getPropertyDefs()) { propDefs.add(create(qPd)); } return nt; }