本文整理了Java中org.apache.jackrabbit.spi.QNodeDefinition.allowsSameNameSiblings
方法的一些代码示例,展示了QNodeDefinition.allowsSameNameSiblings
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QNodeDefinition.allowsSameNameSiblings
方法的具体详情如下:
包路径:org.apache.jackrabbit.spi.QNodeDefinition
类名称:QNodeDefinition
方法名:allowsSameNameSiblings
[英]Reports whether this node can have same-name siblings.
[中]报告此节点是否可以具有同名同级。
代码示例来源:origin: apache/jackrabbit
/**
* {@inheritDoc}
*/
public boolean allowsSameNameSiblings() {
return ((QNodeDefinition) itemDef).allowsSameNameSiblings();
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-spi-commons
/**
* {@inheritDoc}
*/
public boolean allowsSameNameSiblings() {
return ((QNodeDefinition) itemDef).allowsSameNameSiblings();
}
代码示例来源: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: 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: 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: org.apache.jackrabbit/jackrabbit-jcr2spi
private int getIndex(boolean wspIndex) throws InvalidItemStateException, RepositoryException {
if (parent == null) {
// the root state may never have siblings
return Path.INDEX_DEFAULT;
}
if (wspIndex && revertInfo != null) {
return revertInfo.oldIndex;
} else {
NodeState state = (NodeState) internalGetItemState();
if (state == null || !state.hasDefinition() || state.getDefinition().allowsSameNameSiblings()) {
return parent.getChildIndex(this, wspIndex);
} else {
return Path.INDEX_DEFAULT;
}
}
}
代码示例来源:origin: apache/jackrabbit
private int getIndex(boolean wspIndex) throws InvalidItemStateException, RepositoryException {
if (parent == null) {
// the root state may never have siblings
return Path.INDEX_DEFAULT;
}
if (wspIndex && revertInfo != null) {
return revertInfo.oldIndex;
} else {
NodeState state = (NodeState) internalGetItemState();
if (state == null || !state.hasDefinition() || state.getDefinition().allowsSameNameSiblings()) {
return parent.getChildIndex(this, wspIndex);
} else {
return Path.INDEX_DEFAULT;
}
}
}
代码示例来源:origin: apache/jackrabbit
/** Test for the <code>allowsSameNameSiblings</code> child node attribute. */
public void testSiblingNode() {
QNodeDefinition def = getChildNode("childNodeType", "siblingNode");
assertEquals("siblingNode allowsSameNameSiblings",
true, def.allowsSameNameSiblings());
}
代码示例来源:origin: apache/jackrabbit
public static Operation create(ItemState state, int options) throws RepositoryException {
if (state.isNode() && ((NodeState) state).getDefinition().allowsSameNameSiblings()) {
// in case of SNS-siblings make sure the parent hierarchy entry has
// its child entries loaded.
assertChildNodeEntries(state.getParent());
}
return new Remove(state, state.getParent(), options);
}
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr2spi
public static Operation create(ItemState state, int options) throws RepositoryException {
if (state.isNode() && ((NodeState) state).getDefinition().allowsSameNameSiblings()) {
// in case of SNS-siblings make sure the parent hierarchy entry has
// its child entries loaded.
assertChildNodeEntries(state.getParent());
}
return new Remove(state, state.getParent(), options);
}
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
public boolean allowsSameNameSiblings(NodeId id) {
try {
NodeState ns = getNodeState(id);
NodeState parent = getNodeState(ns.getParentId());
Name name = parent.getChildNodeEntry(id).getName();
EffectiveNodeType ent = ntReg.getEffectiveNodeType(
parent.getNodeTypeName(),
parent.getMixinTypeNames());
QNodeDefinition def = ent.getApplicableChildNodeDef(name, ns.getNodeTypeName(), ntReg);
return def != null ? def.allowsSameNameSiblings() : false;
} catch (Exception e) {
log.warn("Unable to get node definition", e);
return false;
}
}
代码示例来源:origin: apache/jackrabbit
public boolean allowsSameNameSiblings(NodeId id) {
try {
NodeState ns = getNodeState(id);
NodeState parent = getNodeState(ns.getParentId());
Name name = parent.getChildNodeEntry(id).getName();
EffectiveNodeType ent = ntReg.getEffectiveNodeType(
parent.getNodeTypeName(),
parent.getMixinTypeNames());
QNodeDefinition def = ent.getApplicableChildNodeDef(name, ns.getNodeTypeName(), ntReg);
return def != null ? def.allowsSameNameSiblings() : false;
} catch (Exception e) {
log.warn("Unable to get node definition", e);
return false;
}
}
代码示例来源: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
/** 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: 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-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;
}
内容来源于网络,如有侵权,请联系作者删除!