Package org.nuxeo.ecm.core.api
Class DocumentTreeIterator
java.lang.Object
org.nuxeo.ecm.core.api.DocumentTreeIterator
- All Implemented Interfaces:
Iterator<DocumentModel>
An iterator over a tree of documents
The tree is traversed from top to bottom and left to right.
TODO: move this in an utility package
- Author:
- Bogdan Stefanescu
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Queue<Iterator<DocumentModel>>
The sequence queue.protected final DocumentModel
Root document.protected Iterator<DocumentModel>
The current sequence.protected final CoreSession
The document manager session. -
Constructor Summary
ConstructorDescriptionDocumentTreeIterator
(CoreSession session, DocumentModel root) Creates the iterator given the tree root.DocumentTreeIterator
(CoreSession session, DocumentModel root, boolean excludeRoot) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
session
The document manager session. -
root
Root document. -
sequence
The current sequence. -
queue
The sequence queue.
-
-
Constructor Details
-
DocumentTreeIterator
Creates the iterator given the tree root. -
DocumentTreeIterator
-
-
Method Details
-
getNextNonEmptySequence
Gets next non empty sequence from queue.This will remove from the queue all traversed sequences (the empty ones and the first not empty sequence found).
- Returns:
- the first non empty sequence or null if no one was found
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceIterator<DocumentModel>
-
next
- Specified by:
next
in interfaceIterator<DocumentModel>
-
remove
public void remove()- Specified by:
remove
in interfaceIterator<DocumentModel>
-
reset
public void reset()Resets the iterator back to the tree root and clear any cached data.
-