use of org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter in project jackrabbit-oak by apache.
the class NodeTypeImpl method getDeclaredSubtypes.
@Override
public NodeTypeIterator getDeclaredSubtypes() {
List<NodeType> subtypes = Lists.newArrayList();
String oakName = getOakName();
Tree root = definition.getParent();
for (Tree child : root.getChildren()) {
PropertyState supertypes = child.getProperty(JCR_SUPERTYPES);
if (supertypes != null) {
for (String name : supertypes.getValue(Type.NAMES)) {
if (oakName.equals(name)) {
subtypes.add(new NodeTypeImpl(child, mapper));
break;
}
}
}
}
return new NodeTypeIteratorAdapter(subtypes);
}
use of org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter in project jackrabbit-oak by apache.
the class NodeTypeImpl method getSubtypes.
@Override
public NodeTypeIterator getSubtypes() {
Map<String, Set<String>> inheritance = Maps.newHashMap();
Tree root = definition.getParent();
for (Tree child : root.getChildren()) {
String oakName = getOakName(child);
PropertyState supertypes = child.getProperty(JCR_SUPERTYPES);
if (supertypes != null) {
for (String supername : supertypes.getValue(Type.NAMES)) {
Set<String> subtypes = inheritance.get(supername);
if (subtypes == null) {
subtypes = Sets.newHashSet();
inheritance.put(supername, subtypes);
}
subtypes.add(oakName);
}
}
}
Map<String, NodeType> subtypes = Maps.newHashMap();
addSubtypes(getOakName(), subtypes, root, inheritance);
return new NodeTypeIteratorAdapter(subtypes.values());
}
use of org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter in project jackrabbit-oak by apache.
the class ReadOnlyNodeTypeManager method getAllNodeTypes.
@Override
public NodeTypeIterator getAllNodeTypes() throws RepositoryException {
List<NodeType> list = Lists.newArrayList();
Tree types = getTypes();
if (types != null) {
NamePathMapper mapper = getNamePathMapper();
for (Tree type : types.getChildren()) {
list.add(new NodeTypeImpl(type, mapper));
}
}
return new NodeTypeIteratorAdapter(list);
}
use of org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter in project jackrabbit by apache.
the class NodeTypeManagerImpl method getAllNodeTypes.
//----------------------------------------------------< NodeTypeManager >---
/**
* {@inheritDoc}
*/
public NodeTypeIterator getAllNodeTypes() throws RepositoryException {
Name[] ntNames = ntReg.getRegisteredNodeTypes();
ArrayList<NodeType> list = new ArrayList<NodeType>(ntNames.length);
for (Name ntName : ntNames) {
list.add(getNodeType(ntName));
}
return new NodeTypeIteratorAdapter(list);
}
use of org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter in project jackrabbit by apache.
the class NodeTypeManagerImpl method getMixinNodeTypes.
/**
* {@inheritDoc}
*/
public NodeTypeIterator getMixinNodeTypes() throws RepositoryException {
Name[] ntNames = ntReg.getRegisteredNodeTypes();
ArrayList<NodeType> list = new ArrayList<NodeType>(ntNames.length);
for (Name ntName : ntNames) {
NodeType nt = getNodeType(ntName);
if (nt.isMixin()) {
list.add(nt);
}
}
return new NodeTypeIteratorAdapter(list);
}
Aggregations