use of org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter in project jackrabbit by apache.
the class NodeTypeManagerImpl method registerNodeTypes.
/**
* @see NodeTypeManager#registerNodeTypes(javax.jcr.nodetype.NodeTypeDefinition[], boolean)
*/
public NodeTypeIterator registerNodeTypes(NodeTypeDefinition[] ntds, boolean allowUpdate) throws RepositoryException {
List<QNodeTypeDefinition> defs = new ArrayList<QNodeTypeDefinition>(ntds.length);
for (NodeTypeDefinition definition : ntds) {
QNodeTypeDefinition qdef = new QNodeTypeDefinitionImpl(definition, getNamePathResolver(), mgrProvider.getQValueFactory());
if (!allowUpdate && hasNodeType(qdef.getName())) {
throw new NodeTypeExistsException("NodeType " + definition.getName() + " already exists.");
}
defs.add(qdef);
}
getNodeTypeRegistry().registerNodeTypes(defs, allowUpdate);
List<NodeType> nts = new ArrayList<NodeType>();
for (QNodeTypeDefinition def : defs) {
nts.add(getNodeType(def.getName()));
}
return new NodeTypeIteratorAdapter(nts);
}
use of org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter in project jackrabbit by apache.
the class NodeTypeManagerImpl method getPrimaryNodeTypes.
/**
* {@inheritDoc}
*/
public NodeTypeIterator getPrimaryNodeTypes() 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);
}
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 = context.getNodeTypeRegistry().getRegisteredNodeTypes();
Arrays.sort(ntNames);
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);
}
use of org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter in project jackrabbit-oak by apache.
the class ReadOnlyNodeTypeManager method getMixinNodeTypes.
@Override
public NodeTypeIterator getMixinNodeTypes() throws RepositoryException {
List<NodeType> list = Lists.newArrayList();
NodeTypeIterator iterator = getAllNodeTypes();
while (iterator.hasNext()) {
NodeType type = iterator.nextNodeType();
if (type.isMixin()) {
list.add(type);
}
}
return new NodeTypeIteratorAdapter(list);
}
use of org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter in project jackrabbit-oak by apache.
the class ReadOnlyNodeTypeManager method getPrimaryNodeTypes.
@Override
public NodeTypeIterator getPrimaryNodeTypes() throws RepositoryException {
List<NodeType> list = Lists.newArrayList();
NodeTypeIterator iterator = getAllNodeTypes();
while (iterator.hasNext()) {
NodeType type = iterator.nextNodeType();
if (!type.isMixin()) {
list.add(type);
}
}
return new NodeTypeIteratorAdapter(list);
}
Aggregations