com.atlassian.sal.api.search.query
Interface SearchQuery


public interface SearchQuery

Utility class to help with creating a query string for the SearchProvider.search(String,String) method.

Query strings will have the form: &=&=...

Since:
2.0
See Also:
SearchQueryParser

Field Summary
static java.lang.String PARAMETER_SEPARATOR
          The parameter separator value
 
Method Summary
 SearchQuery append(java.lang.String query)
          Appends string query to current query object.
 java.lang.String buildQueryString()
          Builds a url-encoded queryString to use with the SearchProvider.search(String,String) method.
 java.lang.String getParameter(java.lang.String name)
          Returns value of the parameter
 int getParameter(java.lang.String name, int defaultValue)
          Convenient method to return integer value of parameter.
 java.lang.String getSearchString()
           
 SearchQuery setParameter(java.lang.String name, java.lang.String value)
          Sets an arbitrary search parameter to the query string.
 

Field Detail

PARAMETER_SEPARATOR

static final java.lang.String PARAMETER_SEPARATOR
The parameter separator value

See Also:
Constant Field Values
Method Detail

setParameter

SearchQuery setParameter(java.lang.String name,
                         java.lang.String value)
Sets an arbitrary search parameter to the query string. If parameter with given name exists, it will be overriden

Parameters:
name - the search parameter name
value - the search parameter value
Returns:
a reference to this query creator

getParameter

java.lang.String getParameter(java.lang.String name)
Returns value of the parameter

Parameters:
name - the parameter name
Returns:
the parameter value

append

SearchQuery append(java.lang.String query)
Appends string query to current query object. New parameters in query will override old ones.

Parameters:
query - un-encoded query
Returns:
the created and parsed search query

buildQueryString

java.lang.String buildQueryString()
Builds a url-encoded queryString to use with the SearchProvider.search(String,String) method. queryString consists of searchString and parameters.

Returns:
queryString created by this SearchQuery.

getSearchString

java.lang.String getSearchString()
Returns:
the original string that user is searching for. Same as buildQueryString() without parameters and not url-encoded

getParameter

int getParameter(java.lang.String name,
                 int defaultValue)
Convenient method to return integer value of parameter. If parameter does not exist, or is not parsable as Integer it returns defaultValue.

Parameters:
name - The parameter name
defaultValue - The default value if that parameter is not specified
Returns:
the integer value


Copyright © 2009 Atlassian. All Rights Reserved.