Package edu.byu.hbll.box
Class HarvestResult
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<edu.byu.hbll.box.BoxDocument>
-
- edu.byu.hbll.box.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
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description HarvestResult()
Creates an emptyHarvestResult
.HarvestResult(Collection<? extends edu.byu.hbll.box.BoxDocument> documents, com.fasterxml.jackson.databind.node.ObjectNode cursor, boolean more)
Creates a completely initializedHarvestResult
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HarvestResult
addDocument(edu.byu.hbll.box.BoxDocument document)
Same as add() except returns this.HarvestResult
addDocuments(edu.byu.hbll.box.BoxDocument... documents)
Same as addAll() except returns this.HarvestResult
addDocuments(Collection<? extends edu.byu.hbll.box.BoxDocument> documents)
Same as addAll() except returns this.HarvestResult
endGroup(String groupId)
Marks the moment a group finished processing.com.fasterxml.jackson.databind.node.ObjectNode
getCursor()
Returns the cursor to store.boolean
hasMore()
Returns whether or not there are more documents to harvest.HarvestResult
setCursor(com.fasterxml.jackson.databind.node.ObjectNode cursor)
Creates a newHarvestResult
with the given cursor.HarvestResult
setMore(boolean more)
Sets more.HarvestResult
startGroup(String groupId)
Marks the start of a new group to be processed identified by the given groupId.com.fasterxml.jackson.databind.node.ObjectNode
withCursor()
Returns the cursor.-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.util.AbstractCollection
containsAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.List
containsAll
-
-
-
-
Constructor Detail
-
HarvestResult
public HarvestResult()
Creates an emptyHarvestResult
.
-
HarvestResult
public HarvestResult(Collection<? extends edu.byu.hbll.box.BoxDocument> documents, com.fasterxml.jackson.databind.node.ObjectNode cursor, boolean more)
Creates a completely initializedHarvestResult
.- Parameters:
documents
- the resulting documents to be addedcursor
- an object describing where the harvest left offmore
- 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 newHarvestResult
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 emptyObjectNode
.- 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
-
-