Package org.dspace.content.authority
Class Choices
java.lang.Object
org.dspace.content.authority.Choices
Record class to hold a set of Choices returned by an authority in response
to a search.
- Author:
- Larry Stone
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThis authority value has been confirmed as accurate by an interactive user or authoritative policystatic final intThere are multiple matching authority values of equal validity.static final intThe authority encountered an internal failure - this preserves a record in the metadata of why there is no value.static final intThere are no matching answers from the authority.static final intNo reasonable confidence value is availablestatic final intThe authority recommends this submission be rejected.static final intValue is singular and valid but has not been seen and accepted by a human, so its provenance is uncertain.static final intValue has not been set (DB default).intThe confidence level that applies to all values in this result setintIndex of value to be selected by default, if any. -1 means none selected.booleantrue when there are more values to be sent after this result.intIndex of start of this result wrt.intCount of total results availableChoice[]The set of values returned by the authority -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetConfidenceText(int cv) Get the symbolic name corresponding to a confidence value, or CF_NOVALUE's name if the value is unknown.static intGet the value corresponding to a symbolic name of a confidence value, or CF_NOVALUE if the symbol is unknown.static intgetConfidenceValue(String ct, int dflt) Get the value corresponding to a symbolic name of a confidence value, or the given default if the symbol is unknown.booleanisError()Predicate, did this result encounter an error?
-
Field Details
-
CF_ACCEPTED
public static final int CF_ACCEPTEDThis authority value has been confirmed as accurate by an interactive user or authoritative policy- See Also:
-
CF_UNCERTAIN
public static final int CF_UNCERTAINValue is singular and valid but has not been seen and accepted by a human, so its provenance is uncertain.- See Also:
-
CF_AMBIGUOUS
public static final int CF_AMBIGUOUSThere are multiple matching authority values of equal validity.- See Also:
-
CF_NOTFOUND
public static final int CF_NOTFOUNDThere are no matching answers from the authority.- See Also:
-
CF_FAILED
public static final int CF_FAILEDThe authority encountered an internal failure - this preserves a record in the metadata of why there is no value.- See Also:
-
CF_REJECTED
public static final int CF_REJECTEDThe authority recommends this submission be rejected.- See Also:
-
CF_NOVALUE
public static final int CF_NOVALUENo reasonable confidence value is available- See Also:
-
CF_UNSET
public static final int CF_UNSETValue has not been set (DB default).- See Also:
-
values
The set of values returned by the authority -
confidence
public int confidenceThe confidence level that applies to all values in this result set -
start
public int startIndex of start of this result wrt. all results; 0 is start of complete result. Note that length is implicit in values.length. -
total
public int totalCount of total results available -
defaultSelected
public int defaultSelectedIndex of value to be selected by default, if any. -1 means none selected. -
more
public boolean moretrue when there are more values to be sent after this result.
-
-
Constructor Details
-
Choices
Constructor for general purpose- Parameters:
values- values arraystart- start numbertotal- total resultsconfidence- confidence levelmore- whether more values
-
Choices
public Choices(Choice[] values, int start, int total, int confidence, boolean more, int defaultSelected) Constructor for general purpose- Parameters:
values- values arraystart- start numbertotal- total resultsconfidence- confidence levelmore- whether more valuesdefaultSelected- default selected value
-
Choices
public Choices(int confidence) Constructor for error results- Parameters:
confidence- confidence level
-
Choices
public Choices(boolean isError) Constructor for simple empty or error results- Parameters:
isError- whether error
-
-
Method Details
-
isError
public boolean isError()Predicate, did this result encounter an error?- Returns:
- true if this Choices result encountered an error
-
getConfidenceText
Get the symbolic name corresponding to a confidence value, or CF_NOVALUE's name if the value is unknown.- Parameters:
cv- confidence value- Returns:
- String with symbolic name corresponding to value (never null)
-
getConfidenceValue
Get the value corresponding to a symbolic name of a confidence value, or CF_NOVALUE if the symbol is unknown.- Parameters:
ct- symbolic name in String- Returns:
- corresponding value or CF_NOVALUE if not found
-
getConfidenceValue
Get the value corresponding to a symbolic name of a confidence value, or the given default if the symbol is unknown. This lets an application detect invalid data, e.g. in a configuration file.- Parameters:
ct- symbolic name in Stringdflt- the default value to return- Returns:
- corresponding value or CF_NOVALUE if not found
-