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.SearchServiceimport com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.Issueimport com.atlassian.jira.issue.search.SearchResultsimport com.atlassian.jira.jql.parser.JqlQueryParserimport com.atlassian.jira.user.ApplicationUserimport com.atlassian.jira.web.bean.PagerFilterimport com.atlassian.query.Queryfinal 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.
The demo code you gave me is very helpful to me, thank you very much.
: )
It looks like you're new here. Sign in or register to get started.