/** * Returns an array of serializable node definitions for * <code>nodeDefs</code>. * * @param nodeDefs the qualified node definitions. * @return an array of serializable node definitions. */ private static QNodeDefinition[] getSerializableNodeDefs( QNodeDefinition[] nodeDefs) { QNodeDefinition[] serDefs = new QNodeDefinition[nodeDefs.length]; for (int i = 0; i < nodeDefs.length; i++) { if (nodeDefs[i] instanceof Serializable) { serDefs[i] = nodeDefs[i]; } else { serDefs[i] = new QNodeDefinitionImpl(nodeDefs[i]); } } return serDefs; } }
if (getDeclaringNodeType() != null) { sb.append(getDeclaringNodeType().toString()); sb.append('/'); if (definesResidual()) { sb.append('*'); } else { sb.append(getName().toString()); Name[] names = getRequiredPrimaryTypes(); for (int i = 0; i < names.length; i++) { set.add(names[i]);
/** * Creates a new node definition based on a JCR <code>NodeDefinition</code>. * * @param nodeDef the node definition. * @param resolver the name/path resolver of the session that provided the * node definition * @throws NameException if <code>nodeDef</code> contains an illegal * name. * @throws NamespaceException if <code>nodeDef</code> contains a name with * an namespace prefix that is unknown to * <code>resolver</code>. */ public QNodeDefinitionImpl(NodeDefinition nodeDef, NamePathResolver resolver) throws NameException, NamespaceException { this(nodeDef.getName().equals(NameConstants.ANY_NAME.getLocalName()) ? NameConstants.ANY_NAME : resolver.getQName(nodeDef.getName()), nodeDef.getDeclaringNodeType() != null ? resolver.getQName(nodeDef.getDeclaringNodeType().getName()) : null, nodeDef.isAutoCreated(), nodeDef.isMandatory(), nodeDef.getOnParentVersion(), nodeDef.isProtected(), nodeDef.getDefaultPrimaryType() != null ? resolver.getQName(nodeDef.getDefaultPrimaryType().getName()) : null, getNodeTypeNames(nodeDef.getRequiredPrimaryTypes(), resolver), nodeDef.allowsSameNameSiblings()); }
/** * Creates a new node definition based on a JCR <code>NodeDefinition</code>. * * @param nodeDef the node definition. * @param resolver the name/path resolver of the session that provided the * node definition * @throws NameException if <code>nodeDef</code> contains an illegal * name. * @throws NamespaceException if <code>nodeDef</code> contains a name with * an namespace prefix that is unknown to * <code>resolver</code>. */ public QNodeDefinitionImpl(NodeDefinition nodeDef, NamePathResolver resolver) throws NameException, NamespaceException { this(nodeDef.getName().equals(NameConstants.ANY_NAME.getLocalName()) ? NameConstants.ANY_NAME : resolver.getQName(nodeDef.getName()), nodeDef.getDeclaringNodeType() != null ? resolver.getQName(nodeDef.getDeclaringNodeType().getName()) : null, nodeDef.isAutoCreated(), nodeDef.isMandatory(), nodeDef.getOnParentVersion(), nodeDef.isProtected(), nodeDef.getDefaultPrimaryType() != null ? resolver.getQName(nodeDef.getDefaultPrimaryType().getName()) : null, getNodeTypeNames(nodeDef.getRequiredPrimaryTypes(), resolver), nodeDef.allowsSameNameSiblings()); }
/** * Returns a set of serializable node definitions for * <code>nodeDefs</code>. * * @param nodeDefs the node definitions. * @return a set of serializable node definitions. */ private static Set<QNodeDefinition> getSerializableNodeDefs( QNodeDefinition[] nodeDefs) { Set<QNodeDefinition> defs = new HashSet<QNodeDefinition>(); for (QNodeDefinition nd : nodeDefs) { if (nd instanceof Serializable) { defs.add(nd); } else { defs.add(new QNodeDefinitionImpl(nd)); } } return defs; }
/** * Returns a set of serializable node definitions for * <code>nodeDefs</code>. * * @param nodeDefs the node definitions. * @return a set of serializable node definitions. */ private static Set<QNodeDefinition> getSerializableNodeDefs( QNodeDefinition[] nodeDefs) { Set<QNodeDefinition> defs = new HashSet<QNodeDefinition>(); for (QNodeDefinition nd : nodeDefs) { if (nd instanceof Serializable) { defs.add(nd); } else { defs.add(new QNodeDefinitionImpl(nd)); } } return defs; }
/** * {@inheritDoc} */ public QNodeDefinition getNodeDefinition(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException { SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo); try { return new QNodeDefinitionImpl(getNode(nodeId, sInfo).getDefinition(), sInfo.getNamePathResolver()); } catch (NameException e) { throw new RepositoryException(e); } }
/** * {@inheritDoc} */ public QNodeDefinition getNodeDefinition(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException { SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo); try { return new QNodeDefinitionImpl(getNode(nodeId, sInfo).getDefinition(), sInfo.getNamePathResolver()); } catch (NameException e) { throw new RepositoryException(e); } }
/** * Creates a new {@link QNodeDefinition} instance based on the state of this * builder. * * @return a new {@link QNodeDefinition} instance. * @throws IllegalStateException if the instance has not the necessary * information to build the QNodeDefinition * instance. */ public QNodeDefinition build() throws IllegalStateException { return new QNodeDefinitionImpl(getName(), getDeclaringNodeType(), getAutoCreated(), getMandatory(), getOnParentVersion(), getProtected(), getDefaultPrimaryType(), getRequiredPrimaryTypes(), getAllowsSameNameSiblings()); }
/** * Creates a new {@link QNodeDefinition} instance based on the state of this * builder. * * @return a new {@link QNodeDefinition} instance. * @throws IllegalStateException if the instance has not the necessary * information to build the QNodeDefinition * instance. */ public QNodeDefinition build() throws IllegalStateException { return new QNodeDefinitionImpl(getName(), getDeclaringNodeType(), getAutoCreated(), getMandatory(), getOnParentVersion(), getProtected(), getDefaultPrimaryType(), getRequiredPrimaryTypes(), getAllowsSameNameSiblings()); }