Package org.dspace.app.rest.model.query
Enum Class RestSearchOperator
- All Implemented Interfaces:
Serializable,Comparable<RestSearchOperator>,Constable
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 ConstantsEnum ConstantDescriptionThe 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 VALUEThe 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 VALUEThe equals operator is default and will be used if none of the above are matchedThe 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 VALUEThe 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 VALUEThe 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 TypeMethodDescriptionextractValue(String query) This method extracts the value from the query.static RestSearchOperatorThis method will return the correct RestSearchOperator that's bound to the query given in the parameter.Returns a list of dspace operators of this enum's values, plus "query" which is also allowed, but will be transformed inSearchQueryConverterto any of the othersgetRegex()static RestSearchOperatorReturns the enum constant of this class with the specified name.static RestSearchOperator[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
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
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
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
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
The equals operator is default and will be used if none of the above are matched
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
extractValue
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
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
-
getDspaceOperator
-
getListOfAllowedSearchOperatorStrings
Returns a list of dspace operators of this enum's values, plus "query" which is also allowed, but will be transformed inSearchQueryConverterto any of the others- Returns:
- List of dspace operators of this enum's values, plus "query"
-