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 java.lang.ObjectAbstract class for Result
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.String>currentIdsCurrent Ids in the resultprotected java.util.List<FacetResult>facetResultThe FacetResult listprotected java.util.List<T>finalResultThe final Result partstatic java.lang.StringIDLISTCurrent Units in the resultprotected longnbResultNumber of result (might be different on update/delete than currentUnits)static java.lang.StringRESULT_FIELDField containing the full documents result as an array of documentprotected java.util.List<java.lang.Float>scoresCurrent Ids in the resultprotected java.lang.StringscrollIdThe scrollIdprotected longtotalTotal aproximated results out of limitprotected BuilderToken.FILTERARGStypeThe type of the results (Units, ObjectGroups, Objects)
-
Constructor Summary
Constructors Constructor Description Result(BuilderToken.FILTERARGS type)Constructor for empty resultResult(BuilderToken.FILTERARGS type, java.util.Collection<java.lang.String> collection)Constructor from a set, setting the nbResult to the size of Set
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFacetResult(FacetResult facetResult)Add a FacetResultResult<T>addFinal(T document)Add one document into final resultResult<T>addId(java.lang.String id, float score)Ad one Id to CurrentIdsResult<T>clear()Clear the Resultjava.util.List<java.lang.String>getCurrentIds()java.util.List<java.lang.Float>getCurrentScores()java.util.List<FacetResult>getFacet()java.util.List<T>getFinal()java.util.List<T>getListFiltered()longgetNbResult()java.lang.StringgetScrollId()Return ScrollId of ResultlonggetTotal()BuilderToken.FILTERARGSgetType()booleanhasFinalResult()booleanisError()Result<T>putFrom(Result<T> from)Put from argumentvoidsetFinal(org.bson.conversions.Bson projection)Build the array of resultResult<T>setScrollId(java.lang.String scrollId)Add ScrollId to ResultResult<T>setTotal(long total)Result<T>setUpdatedResult(long nb)java.lang.StringtoString()
-
-
-
Field Detail
-
RESULT_FIELD
public static final java.lang.String RESULT_FIELD
Field containing the full documents result as an array of document- See Also:
- Constant Field Values
-
IDLIST
public static final java.lang.String IDLIST
Current Units in the result- See Also:
- Constant Field Values
-
currentIds
protected java.util.List<java.lang.String> currentIds
Current Ids in the result
-
scores
protected java.util.List<java.lang.Float> 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 java.util.List<T> finalResult
The final Result part
-
facetResult
protected java.util.List<FacetResult> facetResult
The FacetResult list
-
scrollId
protected java.lang.String scrollId
The scrollId
-
-
Constructor Detail
-
Result
public Result(BuilderToken.FILTERARGS type)
Constructor for empty result- Parameters:
type- of filter
-
Result
public Result(BuilderToken.FILTERARGS type, java.util.Collection<java.lang.String> collection)
Constructor from a set, setting the nbResult to the size of Set- Parameters:
type- of filtercollection- the set of working collection
-
-
Method Detail
-
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 java.util.List<java.lang.String> getCurrentIds()
- Returns:
- the current Ids
-
getCurrentScores
public java.util.List<java.lang.Float> getCurrentScores()
- Returns:
- the current scores
-
getType
public BuilderToken.FILTERARGS getType()
- Returns:
- the type of Results
-
addId
public Result<T> addId(java.lang.String id, float score)
Ad one Id to CurrentIds- Parameters:
id- the id as String adding to current resultscore- the associated score- Returns:
- this
-
setScrollId
public Result<T> setScrollId(java.lang.String scrollId)
Add ScrollId to Result- Parameters:
scrollId- the scrollid as String adding to current result- Returns:
- this
-
getScrollId
public java.lang.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 java.util.List<T> getFinal()
- Returns:
- the final Result
-
getFacet
public java.util.List<FacetResult> getFacet()
- Returns:
- the list of FacetResult
-
getListFiltered
public java.util.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 java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hasFinalResult
public boolean hasFinalResult()
- Returns:
- boolean check if exist finalResult part
-
-