從 JQL 查詢中獲取問題

final AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
restClient = factory.createWithBasicHttpAuthentication(URI.create(JIRA_SERVER), JIRA_LOGIN, JIRA_PASSWORD);
getFilteredIssues("project = TestProject");

public Iterable<Issue> getFilteredIssues(String filterJql) throws Exception {
    final SearchRestClient searchClient = this.connection.getRestClient().getSearchClient();
    HashSet<String> fields = Sets.newHashSet("*all");

    int total = Integer.MAX_VALUE;
    final ArrayList<Issue> issuesList = new ArrayList<>();
    while(issuesList.size() < total){
        Promise<SearchResult> promiseResult = searchClient.searchJql(filterJql, 50, issuesList.size(), fields);
        final SearchResult issues = promiseResult.get();
        issuesList.addAll((Collection<? extends Issue>) issues.getIssues());
    
        if (total == Integer.MAX_VALUE) {
            total = issues.getTotal();
        }
    }        
    
    return issuesList;
    
}