com.atlassian.jira.gadgets.system
Class SearchQueryBackedResource

java.lang.Object
  extended by com.atlassian.jira.gadgets.system.AbstractResource
      extended by com.atlassian.jira.gadgets.system.SearchQueryBackedResource
Direct Known Subclasses:
AverageAgeChartResource, CreatedVsResolvedResource, HeatMapResource, PieChartResource, RecentlyCreatedChartResource, ResolutionTimeResource, StatsResource, TimeSinceChartResource, TwoDimensionalStatsResource

public abstract class SearchQueryBackedResource
extends AbstractResource

An abstract class used for common search request handling for search request backed resources.

Since:
v4.0

Field Summary
protected  JiraAuthenticationContext authenticationContext
           
protected  ChartUtils chartUtils
           
protected  PermissionManager permissionManager
           
protected static String QUERY_STRING
           
protected  SearchService searchService
           
 
Constructor Summary
SearchQueryBackedResource(ChartUtils chartUtils, JiraAuthenticationContext authenticationContext, SearchService searchService, PermissionManager permissionManager, VelocityRequestContextFactory velocityRequestContextFactory)
           
 
Method Summary
protected  String getFilterTitle(Map<String,Object> params)
          Get the name to display for the given query.
protected  String getFilterUrl(Map<String,Object> params)
          Get the url to send people to for this search.
protected  SearchRequest getSearchRequestAndValidate(String queryString, Collection<ValidationError> errors, Map<String,Object> params)
          Method used for retrieving/building a SearchRequest and validating params.
 
Methods inherited from class com.atlassian.jira.gadgets.system.AbstractResource
createErrorResponse, createIndexingUnavailableResponse, createValidationResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUERY_STRING

protected static final String QUERY_STRING
See Also:
Constant Field Values

chartUtils

protected final ChartUtils chartUtils

authenticationContext

protected final JiraAuthenticationContext authenticationContext

permissionManager

protected final PermissionManager permissionManager

searchService

protected final SearchService searchService
Constructor Detail

SearchQueryBackedResource

public SearchQueryBackedResource(ChartUtils chartUtils,
                                 JiraAuthenticationContext authenticationContext,
                                 SearchService searchService,
                                 PermissionManager permissionManager,
                                 VelocityRequestContextFactory velocityRequestContextFactory)
Method Detail

getSearchRequestAndValidate

protected SearchRequest getSearchRequestAndValidate(String queryString,
                                                    Collection<ValidationError> errors,
                                                    Map<String,Object> params)
Method used for retrieving/building a SearchRequest and validating params.

Parameters:
queryString - a String containing a search criteria. Starts with "filter-" for a search request, "project-" for a project or "jql-" for a jql equest.
errors - a collection of ValidationError object containing all validation message keys.
params - a map to populate with with appropriate entities.
Returns:
a SearchRequest that will restrict the search to the given criteria

getFilterTitle

protected String getFilterTitle(Map<String,Object> params)
Get the name to display for the given query.

Parameters:
params - The params created during chart generation process.
Returns:
For a project, get the project name. For a saved filter, get the name. For a unsaved search, return the anonymous key.

getFilterUrl

protected String getFilterUrl(Map<String,Object> params)
Get the url to send people to for this search.

Parameters:
params - The params created during chart generation process.
Returns:
For a project or filter, send them to the issue navigator. For an unsaved search, return empty string.


Copyright © 2002-2012 Atlassian. All Rights Reserved.