Haven't you wondered how we can link to a query from a template or JSP from a custom page or plugin page? In this recipe, we will see how we can create a link, programmatically and otherwise, to use in various places.
Let us first look at creating a search link programmatically. Perform the following steps:
Create the
Query
object usingJqlQueryBuilder
, as we have seen in the previous recipe.Create a
IssueSearchParamaters
object as shown here:IssueSearchParameters params = SearchService.IssueSearchParameters.builder().query(query).build();
Get an instance of the
SearchService
. It could be injected in the constructor of your plugin using dependency injection, or can be retrieved from theComponentAccessor
class as follows:SearchService searchService = ComponentAccessor.getComponent(SearchService.class);
Retrieve the query path from the
Query
object andIssueSearchParamaters
usingSearchService
, as...