private Node getOrCreateParent(String key) throws RepositoryException { Node p = getParent(key); if (treeManager.isRoot(p)) { Node min = getMinimal(); if (min != null) { p = min; renamePath(p, key); } } return p; }
public Iterator<Property> iterator() { return TreeTraverser.propertyIterator(getNodeSequence().iterator(), errorHandler, inclusionPolicy); }
/** * Create a new {@link NodeSequence} instance with the same parameterization * as this instance. * * @return */ public NodeSequence getNodeSequence() { return new NodeSequenceImpl(treeManager, errorHandler); }
public void testEmptyNodeSequence() throws RepositoryException { Comparator<String> order = Rank.<String>comparableComparator(); TreeManager treeManager = new BTreeManager(testNode, 5, 10, order, true); NodeSequence nodes = ItemSequence.createNodeSequence(treeManager, errorHandler); Iterator<Node> nodeIt = nodes.iterator(); assertTrue(nodeIt.hasNext()); assertTrue(treeManager.isRoot(nodeIt.next())); assertFalse(nodeIt.hasNext()); checkTreeProperty(testNode, 5, 10, order); checkOrder(nodes, order); assertEmpty(nodes); }
private Node getOrCreateParent(String key) throws RepositoryException { Node p = getParent(key); if (treeManager.isRoot(p)) { Node min = getMinimal(); if (min != null) { p = min.getParent(); renamePath(p, key); } } return p; }
static PropertySequence getPropertySequence(Node nMembers, UserManagerImpl userManager) throws RepositoryException { Comparator<String> order = Rank.comparableComparator(); int maxChildren = userManager.getMemberSplitSize(); int minChildren = maxChildren / 2; TreeManager treeManager = new BTreeManager(nMembers, minChildren, maxChildren, order, userManager.isAutoSave()); return ItemSequence.createPropertySequence(treeManager); }
@Override public Node getParent(String key) throws RepositoryException { Node p = getPredecessor(key); if (treeManager.isLeaf(p) && !treeManager.isRoot(p)) { return p.getParent(); } else { return p; } }
/** * Create an iterator of the properties of all nodes of the sub-tree rooted * at <code>root</code>. Exceptions occurring on traversal are ignored. * * @param root root node of the sub-tree to traverse * @return iterator of {@link Property} */ public static Iterator<Property> propertyIterator(Node root) { return propertyIterator(root, ErrorHandler.IGNORE, InclusionPolicy.ALL); }
/** * Create a new {@link PropertySequence} instance with the same * parametrization as this instance. * * @return */ public PropertySequence getPropertySequence() { return new PropertySequenceImpl(treeManager, errorHandler); }
public boolean include(Node node) { try { return treeManager.isLeaf(node); } catch (RepositoryException e) { return false; } } };
/** * Returns the node with the minimal key wrt. {@link TreeManager#getOrder()}. * For the empty sequence this is {@link TreeManager#getRoot()}. */ protected final Node getMinimal() throws RepositoryException { Node p = null; Node n = root; while ((n = getMinimal(n)) != null) { p = n; } return p; }
@SuppressWarnings("unchecked") public boolean evaluate(Object object) { return inclusionPolicy.include((T) object); } });
private Node getOrCreateParent(String key) throws RepositoryException { Node p = getParent(key); if (treeManager.isRoot(p)) { Node min = getMinimal(); if (min != null) { p = min; renamePath(p, key); } } return p; }
public Iterator<Property> iterator() { return TreeTraverser.propertyIterator(getNodeSequence().iterator(), errorHandler, inclusionPolicy); }
/** * Create a new {@link PropertySequence} instance. * * @param treeManager The {@link TreeManager} for managing the mapping * between the sequence view and the JCR hierarchy. * @param errorHandler The {@link ErrorHandler} for handling exceptions * occurring while * @return */ public static PropertySequence createPropertySequence(TreeManager treeManager, ErrorHandler errorHandler) { return new PropertySequenceImpl(treeManager, errorHandler); }
/** * Create a new {@link NodeSequence} instance. * * @param treeManager The {@link TreeManager} for managing the mapping * between the sequence view and the JCR hierarchy. * @param errorHandler The {@link ErrorHandler} for handling exceptions * occurring while * @return */ public static NodeSequence createNodeSequence(TreeManager treeManager, ErrorHandler errorHandler) { return new NodeSequenceImpl(treeManager, errorHandler); }
public boolean include(Node node) { try { return treeManager.isLeaf(node); } catch (RepositoryException e) { return false; } } };
private Node getOrCreateParent(String key) throws RepositoryException { Node p = getParent(key); if (treeManager.isRoot(p)) { Node min = getMinimal(); if (min != null) { p = min; renamePath(p, key); } } return p; }
public Iterator<Property> iterator() { return TreeTraverser.propertyIterator(getNodeSequence().iterator(), errorHandler, inclusionPolicy); }
/** * Create a new {@link PropertySequence} instance. * * @param treeManager The {@link TreeManager} for managing the mapping * between the sequence view and the JCR hierarchy. * @return */ public static PropertySequence createPropertySequence(TreeManager treeManager) { return new PropertySequenceImpl(treeManager, ErrorHandler.IGNORE); }