Package org.dspace.content.authority
Class Choices
- java.lang.Object
-
- org.dspace.content.authority.Choices
-
-
Field Summary
Fields Modifier and Type Field Description static intCF_ACCEPTEDThis authority value has been confirmed as accurate by an interactive user or authoritative policystatic intCF_AMBIGUOUSThere are multiple matching authority values of equal validity.static intCF_FAILEDThe authority encountered an internal failure - this preserves a record in the metadata of why there is no value.static intCF_NOTFOUNDThere are no matching answers from the authority.static intCF_NOVALUENo reasonable confidence value is availablestatic intCF_REJECTEDThe authority recommends this submission be rejected.static intCF_UNCERTAINValue is singular and valid but has not been seen and accepted by a human, so its provenance is uncertain.static intCF_UNSETValue has not been set (DB default).intconfidenceThe confidence level that applies to all values in this result setintdefaultSelectedIndex of value to be selected by default, if any.booleanmoretrue when there are more values to be sent after this result.intstartIndex of start of this result wrt.inttotalCount of total results availableChoice[]valuesThe set of values returned by the authority
-
Constructor Summary
Constructors Constructor Description Choices(boolean isError)Constructor for simple empty or error resultsChoices(int confidence)Constructor for error resultsChoices(Choice[] values, int start, int total, int confidence, boolean more)Constructor for general purposeChoices(Choice[] values, int start, int total, int confidence, boolean more, int defaultSelected)Constructor for general purpose
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringgetConfidenceText(int cv)Get the symbolic name corresponding to a confidence value, or CF_NOVALUE's name if the value is unknown.static intgetConfidenceValue(String ct)Get 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 Detail
-
CF_ACCEPTED
public static final int CF_ACCEPTED
This authority value has been confirmed as accurate by an interactive user or authoritative policy- See Also:
- Constant Field Values
-
CF_UNCERTAIN
public static final int CF_UNCERTAIN
Value is singular and valid but has not been seen and accepted by a human, so its provenance is uncertain.- See Also:
- Constant Field Values
-
CF_AMBIGUOUS
public static final int CF_AMBIGUOUS
There are multiple matching authority values of equal validity.- See Also:
- Constant Field Values
-
CF_NOTFOUND
public static final int CF_NOTFOUND
There are no matching answers from the authority.- See Also:
- Constant Field Values
-
CF_FAILED
public static final int CF_FAILED
The authority encountered an internal failure - this preserves a record in the metadata of why there is no value.- See Also:
- Constant Field Values
-
CF_REJECTED
public static final int CF_REJECTED
The authority recommends this submission be rejected.- See Also:
- Constant Field Values
-
CF_NOVALUE
public static final int CF_NOVALUE
No reasonable confidence value is available- See Also:
- Constant Field Values
-
CF_UNSET
public static final int CF_UNSET
Value has not been set (DB default).- See Also:
- Constant Field Values
-
values
public Choice[] values
The set of values returned by the authority
-
confidence
public int confidence
The confidence level that applies to all values in this result set
-
start
public int start
Index 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 total
Count of total results available
-
defaultSelected
public int defaultSelected
Index of value to be selected by default, if any. -1 means none selected.
-
more
public boolean more
true when there are more values to be sent after this result.
-
-
Constructor Detail
-
Choices
public Choices(Choice[] values, int start, int total, int confidence, boolean more)
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 Detail
-
isError
public boolean isError()
Predicate, did this result encounter an error?- Returns:
- true if this Choices result encountered an error
-
getConfidenceText
public static String getConfidenceText(int cv)
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
public static int getConfidenceValue(String ct)
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
public static int getConfidenceValue(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. 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
-
-