Managing filters programmatically
Be it a beginner in JIRA or a pro, one of the features used often is creating and managing filters. The fact that we can save the searches, share them, and subscribe to it adds a lot of value to JIRA. So, how do we programmatically create and manage filters?
In this recipe, we will learn how to manage filters programmatically.
How to do it...
We will see the various aspects of managing the filters one-by-one:
Creating a filter
Most of the operations on managing filters are done using SearchRequestService
. For creating a filter, following are the steps:
Create the Query to be saved as filter. The Query can be created using
JqlQueryBuilder
, as we have seen in the previous recipes.Create a
SearchRequest
object from the QuerySearchRequest searchRequest = new SearchRequest(query);
Create a JIRA Service Context. If you are in an action class, you can get the service context by calling
getJiraServiceContext()
and if not, an instance can be created as:JiraServiceContext...