Class HarvestResult

  • All Implemented Interfaces:
    Serializable, Cloneable, Iterable<edu.byu.hbll.box.BoxDocument>, Collection<edu.byu.hbll.box.BoxDocument>, List<edu.byu.hbll.box.BoxDocument>, RandomAccess

    public class HarvestResult
    extends ArrayList<edu.byu.hbll.box.BoxDocument>
    Contains a batch of resulting documents and future harvest information for a given harvest.
    Author:
    Charles Draper
    See Also:
    Serialized Form
    • Constructor Detail

      • HarvestResult

        public HarvestResult()
        Creates an empty HarvestResult.
      • HarvestResult

        public HarvestResult​(Collection<? extends edu.byu.hbll.box.BoxDocument> documents,
                             com.fasterxml.jackson.databind.node.ObjectNode cursor,
                             boolean more)
        Creates a completely initialized HarvestResult.
        Parameters:
        documents - the resulting documents to be added
        cursor - an object describing where the harvest left off
        more - whether or not there are more documents to harvest at this time
    • Method Detail

      • setMore

        public HarvestResult setMore​(boolean more)
        Sets more. Default false.
        Parameters:
        more - whether or not there are more documents to harvest at this time.
        Returns:
        this HarvestResult
      • setCursor

        public HarvestResult setCursor​(com.fasterxml.jackson.databind.node.ObjectNode cursor)
        Creates a new HarvestResult with the given cursor.
        Parameters:
        cursor - an object describing where the harvest left off.
        Returns:
        this HarvestResult
      • addDocument

        public HarvestResult addDocument​(edu.byu.hbll.box.BoxDocument document)
        Same as add() except returns this.
        Parameters:
        document - resulting document to add.
        Returns:
        this HarvestResult
      • addDocuments

        public HarvestResult addDocuments​(edu.byu.hbll.box.BoxDocument... documents)
        Same as addAll() except returns this.
        Parameters:
        documents - resulting documents to add.
        Returns:
        this HarvestResult
      • addDocuments

        public HarvestResult addDocuments​(Collection<? extends edu.byu.hbll.box.BoxDocument> documents)
        Same as addAll() except returns this.
        Parameters:
        documents - resulting documents to add.
        Returns:
        this HarvestResult
      • getCursor

        public com.fasterxml.jackson.databind.node.ObjectNode getCursor()
        Returns the cursor to store.
        Returns:
        the cursor
      • hasMore

        public boolean hasMore()
        Returns whether or not there are more documents to harvest.
        Returns:
        the more
      • withCursor

        public com.fasterxml.jackson.databind.node.ObjectNode withCursor()
        Returns the cursor. If cursor is null, it is first set to an empty ObjectNode.
        Returns:
        the cursor
      • startGroup

        public HarvestResult startGroup​(String groupId)
        Marks the start of a new group to be processed identified by the given groupId. This is necessary for identifying orphaned documents and deleting them when they're no longer part of the group.
        Parameters:
        groupId - the group's id
        Returns:
        this
      • endGroup

        public HarvestResult endGroup​(String groupId)
        Marks the moment a group finished processing. This is necessary for identifying orphaned documents and deleting them when they're no longer part of the group.
        Parameters:
        groupId - the group's id
        Returns:
        this