Where can i find "get start" about JQL in java code? Just like "get start about JIRA plugin", I find docs about "JqlClauseBuilder", but i don't know how to use it, where can i find any "get start" or any "demo code"?
What do you mean by "get start" and why do you need any of it?
The API is pretty straight forward there.
(I'm using specific classes here, but remember that with groovy you can just use "def" and it will dynamically map variables without needing explicit class types.)
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.search.SearchResults
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.query.Query
final String JQL_QUERY = "project = \"my project\" and issuetype = task"
final ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
JqlQueryParser jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
SearchService searchService = ComponentAccessor.getComponent(SearchService)
Query query = jqlQueryParser.parseQuery(JQL_QUERY)
SearchResults<Issue> searchResults = searchService.search(currentUser, query, PagerFilter.getUnlimitedFilter())
List<Issue> issues = searchResults.getResults()
for (Issue issue : issues) {
//do something per issue
}
Also take a look at Adaptavist Library: https://library.adaptavist.com/
It contains a lot of verified code with different use cases, so you can get an idea how to do something from them or where to start with the APIs since there are many managers/services to get somewhat familiar with.
Hi Radek,
Thanks, in my plugin, I need to search all users in jira, I just know that i need to use JQL in servlet, but i don't know how to use it. I hadn't heard of this site before today, now I know.
Thanks again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.