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 Details

    • RESULT_FIELD

      public static final String RESULT_FIELD
      Field containing the full documents result as an array of document
      See Also:
    • IDLIST

      public static final String IDLIST
      Current Units in the result
      See Also:
    • 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