com.atlassian.sal.core.search.query
Class DefaultSearchQuery

java.lang.Object
  extended by com.atlassian.sal.core.search.query.DefaultSearchQuery
All Implemented Interfaces:
SearchQuery

public class DefaultSearchQuery
extends Object
implements SearchQuery


Field Summary
 
Fields inherited from interface com.atlassian.sal.api.search.query.SearchQuery
PARAMETER_SEPARATOR
 
Constructor Summary
DefaultSearchQuery(String query)
           
 
Method Summary
 SearchQuery append(String query)
          Appends string query to current query object.
 String buildQueryString()
          Builds a url-encoded queryString to use with the SearchProvider.search(String,String) method.
 String getParameter(String name)
          Returns value of the parameter
 int getParameter(String name, int defaultValue)
          Convenient method to return integer value of parameter.
 String getSearchString()
           
 SearchQuery setParameter(String name, String value)
          Sets an arbitrary search parameter to the query string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSearchQuery

public DefaultSearchQuery(String query)
Method Detail

setParameter

public SearchQuery setParameter(String name,
                                String value)
Description copied from interface: SearchQuery
Sets an arbitrary search parameter to the query string. If parameter with given name exists, it will be overriden

Specified by:
setParameter in interface SearchQuery
Parameters:
name - the search parameter name
value - the search parameter value
Returns:
a reference to this query creator

getParameter

public String getParameter(String name)
Description copied from interface: SearchQuery
Returns value of the parameter

Specified by:
getParameter in interface SearchQuery
Parameters:
name - the parameter name
Returns:
the parameter value

buildQueryString

public String buildQueryString()
Description copied from interface: SearchQuery
Builds a url-encoded queryString to use with the SearchProvider.search(String,String) method. queryString consists of searchString and parameters.

Specified by:
buildQueryString in interface SearchQuery
Returns:
queryString created by this SearchQuery.

append

public SearchQuery append(String query)
Description copied from interface: SearchQuery
Appends string query to current query object. New parameters in query will override old ones.

Specified by:
append in interface SearchQuery
Parameters:
query - un-encoded query
Returns:
the created and parsed search query

getSearchString

public String getSearchString()
Specified by:
getSearchString in interface SearchQuery
Returns:
the original string that user is searching for. Same as SearchQuery.buildQueryString() without parameters and not url-encoded

getParameter

public int getParameter(String name,
                        int defaultValue)
Description copied from interface: SearchQuery
Convenient method to return integer value of parameter. If parameter does not exist, or is not parsable as Integer it returns defaultValue.

Specified by:
getParameter in interface SearchQuery
Parameters:
name - The parameter name
defaultValue - The default value if that parameter is not specified
Returns:
the integer value


Copyright © 2011 Atlassian. All Rights Reserved.