Class DocumentTreeIterator

java.lang.Object
org.nuxeo.ecm.core.api.DocumentTreeIterator
All Implemented Interfaces:
Iterator<DocumentModel>

public class DocumentTreeIterator extends Object implements 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 Details

  • Constructor Details

    • DocumentTreeIterator

      public DocumentTreeIterator(CoreSession session, DocumentModel root)
      Creates the iterator given the tree root.
    • DocumentTreeIterator

      public DocumentTreeIterator(CoreSession session, DocumentModel root, boolean excludeRoot)
  • Method Details

    • getNextNonEmptySequence

      protected Iterator<DocumentModel> 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 interface Iterator<DocumentModel>
    • next

      public DocumentModel next()
      Specified by:
      next in interface Iterator<DocumentModel>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<DocumentModel>
    • reset

      public void reset()
      Resets the iterator back to the tree root and clear any cached data.