Class Choices

java.lang.Object
org.dspace.content.authority.Choices

public class Choices extends Object
Record class to hold a set of Choices returned by an authority in response to a search.
Author:
Larry Stone
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    This authority value has been confirmed as accurate by an interactive user or authoritative policy
    static final int
    There are multiple matching authority values of equal validity.
    static final int
    The authority encountered an internal failure - this preserves a record in the metadata of why there is no value.
    static final int
    There are no matching answers from the authority.
    static final int
    No reasonable confidence value is available
    static final int
    The authority recommends this submission be rejected.
    static final int
    Value is singular and valid but has not been seen and accepted by a human, so its provenance is uncertain.
    static final int
    Value has not been set (DB default).
    int
    The confidence level that applies to all values in this result set
    int
    Index of value to be selected by default, if any. -1 means none selected.
    boolean
    true when there are more values to be sent after this result.
    int
    Index of start of this result wrt.
    int
    Count of total results available
    The set of values returned by the authority
  • Constructor Summary

    Constructors
    Constructor
    Description
    Choices(boolean isError)
    Constructor for simple empty or error results
    Choices(int confidence)
    Constructor for error results
    Choices(Choice[] values, int start, int total, int confidence, boolean more)
    Constructor for general purpose
    Choices(Choice[] values, int start, int total, int confidence, boolean more, int defaultSelected)
    Constructor for general purpose
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Get the symbolic name corresponding to a confidence value, or CF_NOVALUE's name if the value is unknown.
    static int
    Get the value corresponding to a symbolic name of a confidence value, or CF_NOVALUE if the symbol is unknown.
    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.
    boolean
    Predicate, did this result encounter an error?

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • 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:
    • 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:
    • CF_AMBIGUOUS

      public static final int CF_AMBIGUOUS
      There are multiple matching authority values of equal validity.
      See Also:
    • CF_NOTFOUND

      public static final int CF_NOTFOUND
      There are no matching answers from the authority.
      See Also:
    • 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:
    • CF_REJECTED

      public static final int CF_REJECTED
      The authority recommends this submission be rejected.
      See Also:
    • CF_NOVALUE

      public static final int CF_NOVALUE
      No reasonable confidence value is available
      See Also:
    • CF_UNSET

      public static final int CF_UNSET
      Value has not been set (DB default).
      See Also:
    • 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 Details

    • Choices

      public Choices(Choice[] values, int start, int total, int confidence, boolean more)
      Constructor for general purpose
      Parameters:
      values - values array
      start - start number
      total - total results
      confidence - confidence level
      more - 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 array
      start - start number
      total - total results
      confidence - confidence level
      more - whether more values
      defaultSelected - 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

      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 String
      dflt - the default value to return
      Returns:
      corresponding value or CF_NOVALUE if not found