Several issues are printed with this code. But how can I output only the first or only the second issue?
SearchResult searchResult =
restClient.getSearchClient().searchJql(
"project = \"<project>\" AND status = \"open\"" ,
5,
1,
Sets.newHashSet("*all")).
claim();
System.out.println(searchResult.getIssues());
It looks like it is returning a list, so perhaps you can index the value are looking for. Example:
For the first issue:
System.out.println(searchResult.getIssues()[0]);
For the second issue:
System.out.println(searchResult.getIssues()[1]);
Alternatively you could make the code a bit more clear and add one more line:
issueToPrint = searchResult.getIssues()[0];
System.out.prntln(issueToPrint);
In case it returns an empty list (no issues), then you want to make sure it is not empty first, e.g.
List<Issue> issues = searchResult.getIssues()
Issue firstIssue = !issues.isEmpty() ? issues.get(0) : null
But otherwise you cannot limit issue results with JQL. You can do it with REST, but with JQL the closest you get to is by limiting it with the query itself, e.g. "created > startOfWeek()" or something similar, there is no result limit property.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.