/** * {@inheritDoc} */ @Override public boolean isNodeType(Name nodeTypeName) { return ent.includesNodeType(nodeTypeName); }
/** * {@inheritDoc} */ public PropertyDefinition[] getPropertyDefinitions() { QPropertyDefinition[] pda = ent.getAllPropDefs(); PropertyDefinition[] propDefs = new PropertyDefinition[pda.length]; for (int i = 0; i < pda.length; i++) { propDefs[i] = ntMgr.getPropertyDefinition(pda[i]); } return propDefs; }
/** * @param name * @throws ConstraintViolationException */ public void checkAddNodeConstraints(Name name) throws ConstraintViolationException { try { getApplicableChildNodeDef(name, null, null); } catch (NoSuchNodeTypeException nsnte) { String msg = "internal error: inconsistent node type"; log.debug(msg); throw new ConstraintViolationException(msg, nsnte); } }
if (ent.includesNodeType(NameConstants.MIX_SHAREABLE)) { node.addShare(parent.getNodeId()); QPropertyDefinition pd = ent.getApplicablePropertyDef(NameConstants.JCR_MIXINTYPES, PropertyType.NAME, true); createPropertyState(node, pd.getName(), pd.getRequiredType(), pd); for (QPropertyDefinition pd : ent.getAutoCreatePropDefs()) { createPropertyState(node, pd.getName(), pd.getRequiredType(), pd); for (QNodeDefinition nd : ent.getAutoCreateNodeDefs()) { createNodeState(node, nd.getName(), nd.getDefaultPrimaryType(), null, null, nd);
public QPropertyDefinition getApplicablePropertyDef(EffectiveNodeType ent) throws ConstraintViolationException { if (multipleStatus == MultipleStatus.MULTIPLE) { return ent.getApplicablePropertyDef(name, type, true); } else if (multipleStatus == MultipleStatus.SINGLE) { return ent.getApplicablePropertyDef(name, type, false); } else { // multipleStatus == MultipleStatus.UNKNOWN if (values.length == 1) { // one value => could be single- or multi-valued return ent.getApplicablePropertyDef(name, type); } else { // zero or more than one values => must be multi-valued return ent.getApplicablePropertyDef(name, type, true); } } }
NodeId id = null; EffectiveNodeType ent = getEffectiveNodeType(srcState); boolean referenceable = ent.includesNodeType(NameConstants.MIX_REFERENCEABLE); boolean versionable = ent.includesNodeType(NameConstants.MIX_SIMPLE_VERSIONABLE); boolean fullVersionable = ent.includesNodeType(NameConstants.MIX_VERSIONABLE); boolean shareable = ent.includesNodeType(NameConstants.MIX_SHAREABLE); switch (flag) { case COPY: QPropertyDefinition def = ent.getApplicablePropertyDef( srcChildState.getName(), srcChildState.getType(), srcChildState.isMultiValued());
try { def = ent.getApplicablePropertyDef(name, type, true); } catch (ConstraintViolationException cve) { def = ent.getApplicablePropertyDef(name, PropertyType.UNDEFINED, true); EffectiveNodeType.checkSetPropertyValueConstraints(def, internalValues); return true; } catch (NameException be) {
throws NodeTypeConflictException, NoSuchNodeTypeException { EffectiveNodeType ent = new EffectiveNodeType(); Name ntName = ntd.getName(); EffectiveNodeType base = NodeTypeRegistry.getEffectiveNodeType(supertypes, entCache, ntdCache); ent.internalMerge(base, true); ent.orderableChildNodes = true; } else { Name[] nta = ent.getInheritedNodeTypes(); for (Name aNta : nta) { QNodeTypeDefinition def = ntdCache.get(aNta); ent.primaryItemName = ntd.getPrimaryItemName(); } else { Name[] nta = ent.getInheritedNodeTypes(); for (Name aNta : nta) { QNodeTypeDefinition def = ntdCache.get(aNta);
/** * {@inheritDoc} */ public boolean canAddChildNode(String childNodeName) { try { ent.checkAddNodeConstraints(resolver.getQName(childNodeName)); return true; } catch (NameException be) { // implementation specific exception, fall through } catch (RepositoryException re) { // fall through } return false; }
/** * Package private factory method for creating a new 'empty' effective * node type instance. * * @return an 'empty' effective node type instance. */ static EffectiveNodeType create() { return new EffectiveNodeType(); }
/** * {@inheritDoc} */ public boolean canRemoveItem(String itemName) { try { ent.checkRemoveItemConstraints(resolver.getQName(itemName)); return true; } catch (NameException be) { // implementation specific exception, fall through } catch (RepositoryException re) { // fall through } return false; }
/** * Returns <code>true</code> if removing the child node called * <code>nodeName</code> is allowed by this node type. Returns * <code>false</code> otherwise. * * @param nodeName The name of the child node * @return a boolean * @since JCR 2.0 */ public boolean canRemoveNode(String nodeName) { try { ent.checkRemoveNodeConstraints(resolver.getQName(nodeName)); return true; } catch (NameException be) { // implementation specific exception, fall through } catch (RepositoryException re) { // fall through } return false; }
/** * Returns <code>true</code> if removing the property called * <code>propertyName</code> is allowed by this node type. Returns * <code>false</code> otherwise. * * @param propertyName The name of the property * @return a boolean * @since JCR 2.0 */ public boolean canRemoveProperty(String propertyName) { try { ent.checkRemovePropertyConstraints(resolver.getQName(propertyName)); return true; } catch (NameException be) { // implementation specific exception, fall through } catch (RepositoryException re) { // fall through } return false; } }
if (ent.includesNodeType(NameConstants.MIX_SHAREABLE)) { node.addShare(parent.getNodeId()); QPropertyDefinition pd = ent.getApplicablePropertyDef(NameConstants.JCR_MIXINTYPES, PropertyType.NAME, true); createPropertyState(node, pd.getName(), pd.getRequiredType(), pd); for (QPropertyDefinition pd : ent.getAutoCreatePropDefs()) { createPropertyState(node, pd.getName(), pd.getRequiredType(), pd); for (QNodeDefinition nd : ent.getAutoCreateNodeDefs()) { createNodeState(node, nd.getName(), nd.getDefaultPrimaryType(), null, null, nd);
@Override public QPropertyDefinition getApplicablePropertyDef(EffectiveNodeType ent) throws ConstraintViolationException { // The eventual target type has to be checked not the current in between type. // This is relevant for dereferenced Reference's, because they are exported as String's. int checkType = type; if (isPathReference) { checkType = PropertyType.REFERENCE; } if (values.length == 1 || binaryURLs.length == 1) { // could be single- or multi-valued (n == 1) return ent.getApplicablePropertyDef(name, checkType); } else { // can only be multi-valued (n == 0 || n > 1) return ent.getApplicablePropertyDef(name, checkType, true); } }
NodeId id = null; EffectiveNodeType ent = getEffectiveNodeType(srcState); boolean referenceable = ent.includesNodeType(NameConstants.MIX_REFERENCEABLE); boolean versionable = ent.includesNodeType(NameConstants.MIX_SIMPLE_VERSIONABLE); boolean fullVersionable = ent.includesNodeType(NameConstants.MIX_VERSIONABLE); boolean shareable = ent.includesNodeType(NameConstants.MIX_SHAREABLE); switch (flag) { case COPY: QPropertyDefinition def = ent.getApplicablePropertyDef( srcChildState.getName(), srcChildState.getType(), srcChildState.isMultiValued());
try { def = ent.getApplicablePropertyDef(name, type, true); } catch (ConstraintViolationException cve) { def = ent.getApplicablePropertyDef(name, PropertyType.UNDEFINED, true); EffectiveNodeType.checkSetPropertyValueConstraints(def, internalValues); return true; } catch (NameException be) {
throws NodeTypeConflictException, NoSuchNodeTypeException { EffectiveNodeType ent = new EffectiveNodeType(); Name ntName = ntd.getName(); EffectiveNodeType base = NodeTypeRegistry.getEffectiveNodeType(supertypes, entCache, ntdCache); ent.internalMerge(base, true); ent.orderableChildNodes = true; } else { Name[] nta = ent.getInheritedNodeTypes(); for (Name aNta : nta) { QNodeTypeDefinition def = ntdCache.get(aNta); ent.primaryItemName = ntd.getPrimaryItemName(); } else { Name[] nta = ent.getInheritedNodeTypes(); for (Name aNta : nta) { QNodeTypeDefinition def = ntdCache.get(aNta);
/** * {@inheritDoc} */ public boolean canAddChildNode(String childNodeName) { try { ent.checkAddNodeConstraints(resolver.getQName(childNodeName)); return true; } catch (NameException be) { // implementation specific exception, fall through } catch (RepositoryException re) { // fall through } return false; }
/** * Package private factory method for creating a new 'empty' effective * node type instance. * * @return an 'empty' effective node type instance. */ static EffectiveNodeType create() { return new EffectiveNodeType(); }