Enum Class RestSearchOperator

java.lang.Object
java.lang.Enum<RestSearchOperator>
org.dspace.app.rest.model.query.RestSearchOperator
All Implemented Interfaces:
Serializable, Comparable<RestSearchOperator>, Constable

public enum RestSearchOperator extends Enum<RestSearchOperator>
This enum defines the different operators that can be used with DSpace They've been given a regex and the string value of the operator that is used within DSpace. The purpose of this class is so that the front-end can use these specifications to send queries using just a search String as defined by the regexes instead of having to pass on the String value of the operator separately.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The authority operator can be used by adding an id: in front of the search query It then becomes id:VALUE to call for a search on the authority operator for VALUE
    The contains operator can be used by adding a * behind the search query It then becomes VALUE* to call for a search on the contains operator for VALUE
    The equals operator is default and will be used if none of the above are matched
    The notauthority operator can be used by adding a -id: in front of the search query It then becomes -id:VALUE to call for a search on the notauthority operator for VALUE
    The notcontains operator can be used by adding a - (minus) in front of the search query and a * at the end It then becomes -VALUE* to call for a search on the notcontains operator for VALUE
    The notequals operator can be used by adding a - in front of the search query It then becomes -VALUE to call for a search on the notequals operator for VALUE
  • Method Summary

    Modifier and Type
    Method
    Description
    This method extracts the value from the query.
    This method will return the correct RestSearchOperator that's bound to the query given in the parameter.
     
    static List<String>
    Returns a list of dspace operators of this enum's values, plus "query" which is also allowed, but will be transformed in SearchQueryConverter to any of the others
     
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • NOTCONTAINS

      public static final RestSearchOperator NOTCONTAINS
      The notcontains operator can be used by adding a - (minus) in front of the search query and a * at the end It then becomes -VALUE* to call for a search on the notcontains operator for VALUE
    • NOTAUTHORITY

      public static final RestSearchOperator NOTAUTHORITY
      The notauthority operator can be used by adding a -id: in front of the search query It then becomes -id:VALUE to call for a search on the notauthority operator for VALUE
    • NOTEQUALS

      public static final RestSearchOperator NOTEQUALS
      The notequals operator can be used by adding a - in front of the search query It then becomes -VALUE to call for a search on the notequals operator for VALUE
    • CONTAINS

      public static final RestSearchOperator CONTAINS
      The contains operator can be used by adding a * behind the search query It then becomes VALUE* to call for a search on the contains operator for VALUE
    • AUTHORITY

      public static final RestSearchOperator AUTHORITY
      The authority operator can be used by adding an id: in front of the search query It then becomes id:VALUE to call for a search on the authority operator for VALUE
    • EQUALS

      public static final RestSearchOperator EQUALS
      The equals operator is default and will be used if none of the above are matched
  • Method Details

    • values

      public static RestSearchOperator[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static RestSearchOperator valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • extractValue

      public String extractValue(String query)
      This method extracts the value from the query. It effectively removes the operator parts and returns only the VALUE
      Parameters:
      query - The full query that was used
      Returns:
      The value that was passed along in the query without the search operator logic
    • forQuery

      public static RestSearchOperator forQuery(String query)
      This method will return the correct RestSearchOperator that's bound to the query given in the parameter. This method will check if the query matches the patterns specified above.
      Parameters:
      query - The query for which we'll return the appropriate RestSearchOperator
      Returns:
      The RestSearchOperator that matches with the query
    • getRegex

      public Pattern getRegex()
    • getDspaceOperator

      public String getDspaceOperator()
    • getListOfAllowedSearchOperatorStrings

      public static List<String> getListOfAllowedSearchOperatorStrings()
      Returns a list of dspace operators of this enum's values, plus "query" which is also allowed, but will be transformed in SearchQueryConverter to any of the others
      Returns:
      List of dspace operators of this enum's values, plus "query"