Package fr.gouv.vitam.metadata.core.database.collections

# Class Result<T>

java.lang.Object
fr.gouv.vitam.metadata.core.database.collections.Result<T>

Type Parameters:
  `T` - Parameter Type

Direct Known Subclasses:
  `ResultDefault`, `ResultError`

public abstract class Result<T> extends Object
Abstract class for Result

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected List<String>`
  `currentIds`
  Current Ids in the result
  `protected List<FacetResult>`
  `facetResult`
  The FacetResult list
  `protected List<T>`
  `finalResult`
  The final Result part
  `static final String`
  `IDLIST`
  Current Units in the result
  `protected long`
  `nbResult`
  Number of result (might be different on update/delete than currentUnits)
  `static final String`
  `RESULT_FIELD`
  Field containing the full documents result as an array of document
  `protected List<Double>`
  `scores`
  Current Ids in the result
  `protected String`
  `scrollId`
  The scrollId
  `protected long`
  `total`
  Total aproximated results out of limit
  `protected final BuilderToken.FILTERARGS`
  `type`
  The type of the results (Units, ObjectGroups, Objects)

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Result(BuilderToken.FILTERARGS type)`
  Constructor for empty result
  `Result(BuilderToken.FILTERARGS type, Collection<String> collection)`
  Constructor from a set, setting the nbResult to the size of Set

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addFacetResult(FacetResult facetResult)`
  Add a FacetResult
  `Result<T>`
  `addFinal(T document)`
  Add one document into final result
  `Result<T>`
  `addId(String id, double score)`
  Ad one Id to CurrentIds
  `Result<T>`
  `clear()`
  Clear the Result
  `List<String>`
  `getCurrentIds()`
  `List<Double>`
  `getCurrentScores()`
  `List<FacetResult>`
  `getFacet()`
  `List<T>`
  `getFinal()`
  `List<T>`
  `getListFiltered()`
  `final long`
  `getNbResult()`
  `String`
  `getScrollId()`
  Return ScrollId of Result
  `long`
  `getTotal()`
  `BuilderToken.FILTERARGS`
  `getType()`
  `boolean`
  `hasFinalResult()`
  `boolean`
  `isError()`
  `Result<T>`
  `putFrom(Result<T> from)`
  Put from argument
  `void`
  `setFinal(org.bson.conversions.Bson projection)`
  Build the array of result
  `Result<T>`
  `setScrollId(String scrollId)`
  Add ScrollId to Result
  `Result<T>`
  `setTotal(long total)`
  `final Result<T>`
  `setUpdatedResult(long nb)`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### RESULT_FIELD

    public static final String RESULT_FIELD
    Field containing the full documents result as an array of document
    See Also:
      - Constant Field Values

  - ### IDLIST

    public static final String IDLIST
    Current Units in the result
    See Also:
      - Constant Field Values

  - ### currentIds

    protected List<String> currentIds
    Current Ids in the result

  - ### scores

    protected List<Double> scores
    Current Ids in the result

  - ### nbResult

    protected long nbResult
    Number of result (might be different on update/delete than currentUnits)

  - ### total

    protected long total
    Total aproximated results out of limit

  - ### type

    protected final BuilderToken.FILTERARGS type
    The type of the results (Units, ObjectGroups, Objects)

  - ### finalResult

    protected List<T> finalResult
    The final Result part

  - ### facetResult

    protected List<FacetResult> facetResult
    The FacetResult list

  - ### scrollId

    protected String scrollId
    The scrollId

- ## Constructor Details

  - ### Result

    public Result(BuilderToken.FILTERARGS type)
    Constructor for empty result
    Parameters:
      `type` - of filter

  - ### Result

    public Result(BuilderToken.FILTERARGS type, Collection<String> collection)
    Constructor from a set, setting the nbResult to the size of Set
    Parameters:
      `type` - of filter
      `collection` - the set of working collection

- ## Method Details

  - ### clear

    public Result<T> clear()
    Clear the Result
    Returns:
      this

  - ### putFrom

    public Result<T> putFrom(Result<T> from)
    Put from argument
    Parameters:
      `from` - the Result for creating another
    Returns:
      Result created

  - ### isError

    public boolean isError()
    Returns:
      True if this result is in error status (list containing error status)

  - ### getCurrentIds

    public List<String> getCurrentIds()
    Returns:
      the current Ids

  - ### getCurrentScores

    public List<Double> getCurrentScores()
    Returns:
      the current scores

  - ### getType

    public BuilderToken.FILTERARGS getType()
    Returns:
      the type of Results

  - ### addId

    public Result<T> addId(String id, double score)
    Ad one Id to CurrentIds
    Parameters:
      `id` - the id as String adding to current result
      `score` - the associated score
    Returns:
      this

  - ### setScrollId

    public Result<T> setScrollId(String scrollId)
    Add ScrollId to Result
    Parameters:
      `scrollId` - the scrollid as String adding to current result
    Returns:
      this

  - ### getScrollId

    public String getScrollId()
    Return ScrollId of Result
    Returns:
      ScrollId

  - ### getNbResult

    public final long getNbResult()
    Returns:
      the nbResult

  - ### setUpdatedResult

    public final Result<T> setUpdatedResult(long nb)
    Parameters:
      `nb` - the number of updated elements
    Returns:
      this

  - ### getTotal

    public long getTotal()
    Returns:
      the approximative total of responses possible, out of limit

  - ### setTotal

    public Result<T> setTotal(long total)
    Parameters:
      `total` - the approximative total of responses possible, out of limit
    Returns:
      this

  - ### getFinal

    public List<T> getFinal()
    Returns:
      the final Result

  - ### getFacet

    public List<FacetResult> getFacet()
    Returns:
      the list of FacetResult

  - ### getListFiltered

    public List<T> getListFiltered() throws InvalidParseOperationException
    Returns:
      the filtered list for Select operation
    Throws:
      `InvalidParseOperationException` - if exception occurred when getting the filter list

  - ### addFinal

    public Result<T> addFinal(T document)
    Add one document into final result
    Parameters:
      `document` - of type MetaDataDocument adding to result

  - ### setFinal

    public void setFinal(org.bson.conversions.Bson projection)
    Build the array of result
    Parameters:
      `projection` - the project of document

  - ### addFacetResult

    public void addFacetResult(FacetResult facetResult)
    Add a FacetResult
    Parameters:
      `facetResult` - facetResult

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### hasFinalResult

    public boolean hasFinalResult()
    Returns:
      boolean check if exist finalResult part