本文整理了Java中javax.jcr.Node.getMixinNodeTypes()
方法的一些代码示例,展示了Node.getMixinNodeTypes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getMixinNodeTypes()
方法的具体详情如下:
包路径:javax.jcr.Node
类名称:Node
方法名:getMixinNodeTypes
[英]Returns an array of NodeType
objects representing the mixin node types in effect for this node. This includes only those mixin types explicitly assigned to this node. It does not include mixin types inherited through the addition of supertypes to the primary type hierarchy or through the addition of supertypes to the type hierarchy of any of the declared mixin types.
[中]返回NodeType
对象的数组,这些对象表示此节点有效的mixin节点类型。这仅包括显式分配给此节点的那些mixin类型。它不包括通过将超类型添加到主类型层次结构或通过将超类型添加到任何已声明的mixin类型的类型层次结构而继承的mixin类型。
代码示例来源:origin: apache/jackrabbit-oak
@Override
protected void runTest() throws Exception {
for (int i = 0; i < 10000; i++) {
node.getMixinNodeTypes();
}
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector
/**
* @inheritDoc
*/
public NodeType[] getMixinNodeTypes() throws RepositoryException {
return node.getMixinNodeTypes();
}
代码示例来源:origin: org.jcrom/jcrom
static boolean hasMixinType(Node node, String mixinType) throws RepositoryException {
for (NodeType nodeType : node.getMixinNodeTypes()) {
if (nodeType.getName().equals(mixinType)) {
return true;
}
}
return false;
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-console-frontend
private Collection<String> getDeclaredMixinTypes(final Node node) throws RepositoryException {
final List<String> result = new ArrayList<String>();
for (NodeType nodeType : node.getMixinNodeTypes()) {
result.add(nodeType.getName());
}
return result;
}
代码示例来源:origin: org.chtijbug.drools/guvnor-repository
private boolean hasMixin(Node node) {
try {
NodeType[] nodeTypes = node.getMixinNodeTypes();
for (NodeType nodeType : nodeTypes) {
if (nodeType.isNodeType("mix:shareable")) {
return true;
}
}
} catch (RepositoryException e) {
}
return false;
}
代码示例来源:origin: org.onehippo.cms7/hippo-services-contenttype
@Override
public ContentType getContentTypeForNode(Node node) throws RepositoryException {
Set<String> names = new HashSet<String>();
names.add(node.getPrimaryNodeType().getName());
for (NodeType mixin : node.getMixinNodeTypes()) {
names.add(mixin.getName());
}
return getAggregatedContentType(names);
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
public long size() {
long result = 0;
try {
if (nodeModel.getObject() != null) {
NodeType[] nodeTypes = nodeModel.getObject().getMixinNodeTypes();
result = nodeTypes.length;
}
} catch (RepositoryException e) {
log.error(e.getMessage());
}
return result;
}
代码示例来源:origin: org.chromattic/chromattic.core
public boolean isReferenceable(Node node) throws RepositoryException {
//
for (NodeType nt : node.getMixinNodeTypes()) {
if (nt.getName().equals("mix:referenceable")) {
return true;
}
}
//
PrimaryTypeInfo ntInfo = (PrimaryTypeInfo)getTypeInfo(node.getPrimaryNodeType());
//
return ntInfo.getMixinNames().contains("mix:referenceable");
}
代码示例来源:origin: apache/jackrabbit-oak
private static boolean isOrderable(Node node) throws RepositoryException {
if (node.getPrimaryNodeType().hasOrderableChildNodes()) {
return true;
}
NodeType[] types = node.getMixinNodeTypes();
for (NodeType type : types) {
if (type.hasOrderableChildNodes()) {
return true;
}
}
return false;
}
代码示例来源:origin: ModeShape/modeshape
protected boolean hasMixin( Node node,
String mixinNodeType ) throws RepositoryException {
for (NodeType mixin : node.getMixinNodeTypes()) {
if (mixin.getName().equals(mixinNodeType)) return true;
}
return false;
}
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape
public static boolean hasPropertyDefinition(Node node, String propName) {
try {
return hasPropertyDefinition(node.getPrimaryNodeType(), node.getMixinNodeTypes(), propName);
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to retrieve property definitions for node: " + node, e);
}
}
代码示例来源:origin: ModeShape/modeshape
protected void assertHasMixins( Node node,
String... mixinNodeTypes ) throws RepositoryException {
List<String> mixins = new ArrayList<String>();
for (NodeType nodeType : node.getMixinNodeTypes()) {
mixins.add(nodeType.getName());
}
for (String expectedMixin : mixinNodeTypes) {
assertThat(expectedMixin + "mixin not found", mixins.contains(expectedMixin), is(true));
}
}
代码示例来源:origin: apache/jackrabbit-oak
public static PropertyDefinition[] getAggregatedPropertyDefinitionss(Node node) throws RepositoryException {
Set<PropertyDefinition> pDefs = newHashSet();
PropertyDefinition pd[] = node.getPrimaryNodeType().getPropertyDefinitions();
pDefs.addAll(Arrays.asList(pd));
NodeType[] mixins = node.getMixinNodeTypes();
for (NodeType mixin : mixins) {
pd = mixin.getPropertyDefinitions();
pDefs.addAll(Arrays.asList(pd));
}
return pDefs.toArray(new PropertyDefinition[pDefs.size()]);
}
代码示例来源:origin: apache/jackrabbit-oak
private static NodeDefinition[] getAggregatedNodeDefinitions(Node node) throws RepositoryException {
Set<NodeDefinition> cDefs = newHashSet();
NodeDefinition[] nd = node.getPrimaryNodeType().getChildNodeDefinitions();
cDefs.addAll(Arrays.asList(nd));
NodeType[] mixins = node.getMixinNodeTypes();
for (NodeType mixin : mixins) {
nd = mixin.getChildNodeDefinitions();
cDefs.addAll(Arrays.asList(nd));
}
return cDefs.toArray(new NodeDefinition[cDefs.size()]);
}
代码示例来源:origin: ModeShape/modeshape
private void assertHasPackageMixin( final Node node ) throws Exception {
for (final NodeType mixin : node.getMixinNodeTypes()) {
if (ClassFileSequencerLexicon.PACKAGE.equals(mixin.getName())) {
return;
}
}
fail("Node '" + node.getPath() + "' does not have the java package mixin");
}
代码示例来源:origin: apache/jackrabbit-oak
/**
* Verify that transient changes to jcr:mixinTypes are reflected in the
* API call {@link javax.jcr.Node#getMixinNodeTypes()}.
*/
public void testNodeGetMixinTypesWithTransientModifications() throws Exception {
int noMixins = superuser.getNode(path).getMixinNodeTypes().length;
Node node = superuser.getNode(path);
node.addMixin(NodeType.MIX_CREATED);
NodeType[] mixins = node.getMixinNodeTypes();
assertEquals(noMixins+1, mixins.length);
}
代码示例来源:origin: apache/jackrabbit
public void testNodeGetMixinTypesWithTransientModifications() throws Exception {
int noMixins = superuser.getNode(path).getMixinNodeTypes().length;
Node node = superuser.getNode(path);
node.addMixin(NodeType.MIX_CREATED);
NodeType[] mixins = node.getMixinNodeTypes();
assertEquals(noMixins+1, mixins.length);
}
}
代码示例来源:origin: ModeShape/modeshape
protected void assertColumn( Node row, int index, String data ) throws RepositoryException {
Node column = row.getNode("text:column[" + (index + 1) + "]");
assertEquals(NT_UNSTRUCTURED, column.getPrimaryNodeType().getName());
List<String> mixinNames = new ArrayList<String>();
for (NodeType mixinType : column.getMixinNodeTypes()) {
mixinNames.add(mixinType.getName());
}
assertTrue(mixinNames.contains(COLUMN));
assertEquals(data, column.getProperty(DATA).getString());
}
}
代码示例来源:origin: apache/jackrabbit-oak
public void testMixins() throws RepositoryException {
acMgr.setPolicy(testRoot, acl);
NodeType[] mixins = superuser.getNode(acl.getPath()).getMixinNodeTypes();
NodeType[] expectedMixins = null;
assertArrayEquals(expectedMixins, mixins);
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void testNodeHasMixinLockable() throws AccessDeniedException, PathNotFoundException, RepositoryException {
// GIVEN
MockNode root = new MockNode("root");
// WHEN
Node child = NodeUtil.createPath(root, "some/really/important/page", "mgnl:page");
// THEN
Iterable<Node> nodes = NodeUtil.collectAllChildren(child);
for (Node node : nodes) {
assertTrue(node.getMixinNodeTypes()[0].getName().equals("mix:lockable"));
}
}
内容来源于网络,如有侵权,请联系作者删除!