本文整理了Java中org.apache.jackrabbit.spi.QNodeDefinition.getDefaultPrimaryType
方法的一些代码示例,展示了QNodeDefinition.getDefaultPrimaryType
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QNodeDefinition.getDefaultPrimaryType
方法的具体详情如下:
包路径:org.apache.jackrabbit.spi.QNodeDefinition
类名称:QNodeDefinition
方法名:getDefaultPrimaryType
[英]Returns the name of the default primary type.
[中]
代码示例来源:origin: apache/jackrabbit
/**
* @see NodeDefinition#getDefaultPrimaryTypeName()
* @since JCR 2.0
*/
public String getDefaultPrimaryTypeName() {
Name ntName = ((QNodeDefinition) itemDef).getDefaultPrimaryType();
if (ntName == null) {
return null;
}
try {
return resolver.getJCRName(ntName);
} catch (NamespaceException e) {
// should never get here
log.error("invalid default node type " + ntName, e);
return null;
}
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-spi-commons
/**
* @see NodeDefinition#getDefaultPrimaryTypeName()
* @since JCR 2.0
*/
public String getDefaultPrimaryTypeName() {
Name ntName = ((QNodeDefinition) itemDef).getDefaultPrimaryType();
if (ntName == null) {
return null;
}
try {
return resolver.getJCRName(ntName);
} catch (NamespaceException e) {
// should never get here
log.error("invalid default node type " + ntName, e);
return null;
}
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-spi-commons
/**
* {@inheritDoc}
*/
public NodeType getDefaultPrimaryType() {
if (ntMgr == null) {
// not attached to an existing node type
return null;
}
Name ntName = ((QNodeDefinition) itemDef).getDefaultPrimaryType();
if (ntName == null) {
return null;
}
try {
return ntMgr.getNodeType(ntName);
} catch (NoSuchNodeTypeException e) {
// should never get here
log.error("invalid default node type " + ntName, e);
return null;
}
}
代码示例来源:origin: apache/jackrabbit
/**
* {@inheritDoc}
*/
public NodeType getDefaultPrimaryType() {
if (ntMgr == null) {
// not attached to an existing node type
return null;
}
Name ntName = ((QNodeDefinition) itemDef).getDefaultPrimaryType();
if (ntName == null) {
return null;
}
try {
return ntMgr.getNodeType(ntName);
} catch (NoSuchNodeTypeException e) {
// should never get here
log.error("invalid default node type " + ntName, e);
return null;
}
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-spi-commons
/**
* Compares two node definitions for equality. Returns <code>true</code>
* if the given object is a node definition and has the same attributes
* as this node definition.
*
* @param obj the object to compare this node definition with
* @return <code>true</code> if the object is equal to this node definition,
* <code>false</code> otherwise
* @see Object#equals(Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof QNodeDefinition) {
QNodeDefinition other = (QNodeDefinition) obj;
return super.equals(obj)
&& requiredPrimaryTypes.equals(new HashSet<Name>(
Arrays.asList(other.getRequiredPrimaryTypes())))
&& (defaultPrimaryType == null
? other.getDefaultPrimaryType() == null
: defaultPrimaryType.equals(other.getDefaultPrimaryType()))
&& allowsSameNameSiblings == other.allowsSameNameSiblings();
}
return false;
}
代码示例来源:origin: org.apache.jackrabbit/com.springsource.org.apache.jackrabbit.spi.commons
/**
* Compares two node definitions for equality. Returns <code>true</code>
* if the given object is a node defintion and has the same attributes
* as this node definition.
*
* @param obj the object to compare this node definition with
* @return <code>true</code> if the object is equal to this node definition,
* <code>false</code> otherwise
* @see Object#equals(Object)
*/
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof QNodeDefinition) {
QNodeDefinition other = (QNodeDefinition) obj;
return super.equals(obj)
&& Arrays.equals(requiredPrimaryTypes, other.getRequiredPrimaryTypes())
&& (defaultPrimaryType == null
? other.getDefaultPrimaryType() == null
: defaultPrimaryType.equals(other.getDefaultPrimaryType()))
&& allowsSameNameSiblings == other.allowsSameNameSiblings();
}
return false;
}
代码示例来源:origin: apache/jackrabbit
/**
* Compares two node definitions for equality. Returns <code>true</code>
* if the given object is a node definition and has the same attributes
* as this node definition.
*
* @param obj the object to compare this node definition with
* @return <code>true</code> if the object is equal to this node definition,
* <code>false</code> otherwise
* @see Object#equals(Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof QNodeDefinition) {
QNodeDefinition other = (QNodeDefinition) obj;
return super.equals(obj)
&& requiredPrimaryTypes.equals(new HashSet<Name>(
Arrays.asList(other.getRequiredPrimaryTypes())))
&& (defaultPrimaryType == null
? other.getDefaultPrimaryType() == null
: defaultPrimaryType.equals(other.getDefaultPrimaryType()))
&& allowsSameNameSiblings == other.allowsSameNameSiblings();
}
return false;
}
代码示例来源:origin: apache/jackrabbit
/** Test for the <code>defaultPrimaryType</code> child node attribute. */
public void testDefaultTypeNode() {
QNodeDefinition def = getChildNode("childNodeType", "defaultTypeNode");
assertEquals("defaultTypeNode defaultPrimaryType",
FACTORY.create(Name.NS_NT_URI, "base"),
def.getDefaultPrimaryType());
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-spi-commons
/**
* Copy constructor.
*
* @param nodeDef some other node definition.
*/
public QNodeDefinitionImpl(QNodeDefinition nodeDef) {
this(nodeDef.getName(), nodeDef.getDeclaringNodeType(),
nodeDef.isAutoCreated(), nodeDef.isMandatory(),
nodeDef.getOnParentVersion(), nodeDef.isProtected(),
nodeDef.getDefaultPrimaryType(),
nodeDef.getRequiredPrimaryTypes(),
nodeDef.allowsSameNameSiblings());
}
代码示例来源:origin: apache/jackrabbit
/**
* Copy constructor.
*
* @param nodeDef some other node definition.
*/
public QNodeDefinitionImpl(QNodeDefinition nodeDef) {
this(nodeDef.getName(), nodeDef.getDeclaringNodeType(),
nodeDef.isAutoCreated(), nodeDef.isMandatory(),
nodeDef.getOnParentVersion(), nodeDef.isProtected(),
nodeDef.getDefaultPrimaryType(),
nodeDef.getRequiredPrimaryTypes(),
nodeDef.allowsSameNameSiblings());
}
代码示例来源:origin: org.apache.jackrabbit/com.springsource.org.apache.jackrabbit.spi.commons
/**
* Copy constructor.
*
* @param nodeDef some other node definition.
*/
public QNodeDefinitionImpl(QNodeDefinition nodeDef) {
this(nodeDef.getName(), nodeDef.getDeclaringNodeType(),
nodeDef.isAutoCreated(), nodeDef.isMandatory(),
nodeDef.getOnParentVersion(), nodeDef.isProtected(),
nodeDef.getDefaultPrimaryType(),
nodeDef.getRequiredPrimaryTypes(),
nodeDef.allowsSameNameSiblings());
}
代码示例来源:origin: apache/jackrabbit
/**
* Package private constructor
*
* @param def
* @param resolver
* @throws javax.jcr.nodetype.ConstraintViolationException
*/
NodeDefinitionTemplateImpl(NodeDefinition def, NamePathResolver resolver) throws ConstraintViolationException {
super(def, resolver);
requiredPrimaryTypes = def.getRequiredPrimaryTypes();
allowSameNameSiblings = def.allowsSameNameSiblings();
if (def instanceof NodeDefinitionImpl) {
QNodeDefinition qDef = (QNodeDefinition) ((NodeDefinitionImpl) def).itemDef;
requiredPrimaryTypeNames = qDef.getRequiredPrimaryTypes();
defaultPrimaryTypeName = qDef.getDefaultPrimaryType();
} else {
setRequiredPrimaryTypeNames(def.getRequiredPrimaryTypeNames());
setDefaultPrimaryTypeName(def.getDefaultPrimaryTypeName());
}
}
代码示例来源:origin: apache/jackrabbit
/** Test for the empty child node definition. */
public void testEmptyNode() {
QNodeDefinition def = getChildNode("childNodeType", "emptyNode");
assertEquals("emptyNode allowsSameNameSiblings",
false, def.allowsSameNameSiblings());
assertEquals("emptyNode defaultPrimaryType",
null, def.getDefaultPrimaryType());
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-spi-commons
/**
* Package private constructor
*
* @param def
* @param resolver
* @throws javax.jcr.nodetype.ConstraintViolationException
*/
NodeDefinitionTemplateImpl(NodeDefinition def, NamePathResolver resolver) throws ConstraintViolationException {
super(def, resolver);
requiredPrimaryTypes = def.getRequiredPrimaryTypes();
allowSameNameSiblings = def.allowsSameNameSiblings();
if (def instanceof NodeDefinitionImpl) {
QNodeDefinition qDef = (QNodeDefinition) ((NodeDefinitionImpl) def).itemDef;
requiredPrimaryTypeNames = qDef.getRequiredPrimaryTypes();
defaultPrimaryTypeName = qDef.getDefaultPrimaryType();
} else {
setRequiredPrimaryTypeNames(def.getRequiredPrimaryTypeNames());
setDefaultPrimaryTypeName(def.getDefaultPrimaryTypeName());
}
}
代码示例来源:origin: apache/jackrabbit-oak
private NodeDefinitionTemplate createNodeDefinitionTemplate(NodeTypeManager ntMgr, QNodeDefinition def) throws RepositoryException {
NodeDefinitionTemplate tmpl = ntMgr.createNodeDefinitionTemplate();
Name name = def.getName();
if (name != null) {
tmpl.setName(getOakName(name));
}
tmpl.setAutoCreated(def.isAutoCreated());
tmpl.setMandatory(def.isMandatory());
tmpl.setOnParentVersion(def.getOnParentVersion());
tmpl.setProtected(def.isProtected());
tmpl.setSameNameSiblings(def.allowsSameNameSiblings());
List<String> names = newArrayListWithCapacity(def.getRequiredPrimaryTypes().length);
for (Name type : def.getRequiredPrimaryTypes()) {
names.add(getOakName(type));
}
tmpl.setRequiredPrimaryTypeNames(names.toArray(new String[names.size()]));
Name type = def.getDefaultPrimaryType();
if (type != null) {
tmpl.setDefaultPrimaryTypeName(getOakName(type));
}
return tmpl;
}
代码示例来源:origin: org.apache.jackrabbit/oak-upgrade
private NodeDefinitionTemplate createNodeDefinitionTemplate(NodeTypeManager ntMgr, QNodeDefinition def) throws RepositoryException {
NodeDefinitionTemplate tmpl = ntMgr.createNodeDefinitionTemplate();
Name name = def.getName();
if (name != null) {
tmpl.setName(getOakName(name));
}
tmpl.setAutoCreated(def.isAutoCreated());
tmpl.setMandatory(def.isMandatory());
tmpl.setOnParentVersion(def.getOnParentVersion());
tmpl.setProtected(def.isProtected());
tmpl.setSameNameSiblings(def.allowsSameNameSiblings());
List<String> names = newArrayListWithCapacity(def.getRequiredPrimaryTypes().length);
for (Name type : def.getRequiredPrimaryTypes()) {
names.add(getOakName(type));
}
tmpl.setRequiredPrimaryTypeNames(names.toArray(new String[names.size()]));
Name type = def.getDefaultPrimaryType();
if (type != null) {
tmpl.setDefaultPrimaryTypeName(getOakName(type));
}
return tmpl;
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
pState.setPropertyValues(NameConstants.JCR_REQUIREDPRIMARYTYPES,
PropertyType.NAME, InternalValue.create(cnDef.getRequiredPrimaryTypes()));
if (cnDef.getDefaultPrimaryType() != null) {
pState.setPropertyValue(NameConstants.JCR_DEFAULTPRIMARYTYPE, InternalValue.create(cnDef.getDefaultPrimaryType()));
代码示例来源:origin: apache/jackrabbit
pState.setPropertyValues(NameConstants.JCR_REQUIREDPRIMARYTYPES,
PropertyType.NAME, InternalValue.create(cnDef.getRequiredPrimaryTypes()));
if (cnDef.getDefaultPrimaryType() != null) {
pState.setPropertyValue(NameConstants.JCR_DEFAULTPRIMARYTYPE, InternalValue.create(cnDef.getDefaultPrimaryType()));
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-spi-commons
/**
* Create a new JCR node definition from the given <code>QNodeDefinition</code>.
*
* @param qNd A node definition.
* @return The corresponding JCR node definition.
* @throws RepositoryException if an error occurs.
*/
public NodeDefinition create(QNodeDefinition qNd)
throws RepositoryException {
NodeDefinitionTemplate nt = ntMgr.createNodeDefinitionTemplate();
nt.setName(getJCRName(qNd.getName()));
nt.setAutoCreated(qNd.isAutoCreated());
nt.setMandatory(qNd.isMandatory());
nt.setOnParentVersion(qNd.getOnParentVersion());
nt.setProtected(qNd.isProtected());
nt.setSameNameSiblings(qNd.allowsSameNameSiblings());
nt.setDefaultPrimaryTypeName(getJCRName(qNd.getDefaultPrimaryType()));
nt.setRequiredPrimaryTypeNames(getJCRNames(qNd.getRequiredPrimaryTypes()));
return nt;
}
代码示例来源:origin: apache/jackrabbit
/**
* Create a new JCR node definition from the given <code>QNodeDefinition</code>.
*
* @param qNd A node definition.
* @return The corresponding JCR node definition.
* @throws RepositoryException if an error occurs.
*/
public NodeDefinition create(QNodeDefinition qNd)
throws RepositoryException {
NodeDefinitionTemplate nt = ntMgr.createNodeDefinitionTemplate();
nt.setName(getJCRName(qNd.getName()));
nt.setAutoCreated(qNd.isAutoCreated());
nt.setMandatory(qNd.isMandatory());
nt.setOnParentVersion(qNd.getOnParentVersion());
nt.setProtected(qNd.isProtected());
nt.setSameNameSiblings(qNd.allowsSameNameSiblings());
nt.setDefaultPrimaryTypeName(getJCRName(qNd.getDefaultPrimaryType()));
nt.setRequiredPrimaryTypeNames(getJCRNames(qNd.getRequiredPrimaryTypes()));
return nt;
}
内容来源于网络,如有侵权,请联系作者删除!