JQL Clause Builder API

Hi everyone,

I want to fetch issue results of JQL below by using JIRA API

status was Open DURING ("2013/12/11","2013/12/16")

I tried

JqlQueryBuilder builder 	= JqlQueryBuilder.newBuilder();
	JqlClauseBuilder clauseBuilder 	= builder.where().status("Open").dueBetween("2013/12/11", "2013/12/16");
	Query query = clauseBuilder.buildQuery();
	List<Issue> query_returned_issues	= new ArrayList<Issue>();
	User user 				= ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
	SearchService searchService 		= ComponentAccessor.getComponentOfType(SearchService.class);
	try {
		SearchResults searchResults	= searchService.search(user, query, PagerFilter.getUnlimitedFilter());
		query_returned_issues		= searchResults.getIssues();
	} catch (SearchException e) {	e.printStackTrace();	}

but there is no luck :(

Could you help me, please ?


3 answers

1 accepted

This widget could not be displayed.

Hi Kandiran,

Try with this code below:

First in your class constructer initilize searchProvider as:

searchProvider = componentManager.getSearchProvider(); and

then,

SearchService searchService = ComponentAccessor.getComponentOfType(SearchService.class);

String jqlargument = "project = <project name> and issuetype = \"<Issue type>\"";

SearchService.ParseResult parseResult = searchService.parseQuery(user,jqlargument);

Query query = parseResult.getQuery();

try{

issues = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter()).getIssues();

}catch(SearchException e){

System.out.println("Exception occured:"+e);

}

Hope this helps you,

Patina

This widget could not be displayed.

Thank you Patina,

I used your method by using raw JQL operation and it resolved my problem.

This widget could not be displayed.

Hi, I'm trying to do something similar. Can you point me in the direction where I can get some examples of how to search issues using raw JQL?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

139 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you