public ConcurrentHashMap collectIssues()

in gepard-rest/src/main/java/com/epam/gepard/rest/jira/JiraSiteHandler.java [270:292]


    public ConcurrentHashMap<String, JSONObject> collectIssues(final String query) throws IOException, JSONException {
        String jqlURL = getListOfIssuesByQueryUrl(query);
        WebRequest requestSettings = new WebRequest(new URL(jqlURL), HttpMethod.GET);
        requestSettings.setAdditionalHeader("Content-type", "application/json");
        UnexpectedPage infoPage = webClient.getPage(requestSettings);
        if (infoPage.getWebResponse().getStatusCode() == HTTP_RESPONSE_OK) {
            String ticketList = infoPage.getWebResponse().getContentAsString();
            JSONObject obj = new JSONObject(ticketList);
            String maxResults = obj.getString("maxResults");
            String total = obj.getString("total");
            if (Integer.valueOf(maxResults) < Integer.valueOf(total)) {
                throw new SimpleGepardException("ERROR: Too many issues belong to given query (" + total + "), please change the query to shorten the result list.");
            }
            JSONArray array = obj.getJSONArray("issues");
            ConcurrentHashMap<String, JSONObject> map = new ConcurrentHashMap<>();
            for (int i = 0; i < array.length(); i++) {
                JSONObject o = (JSONObject) array.get(i);
                map.put(o.getString("key"), o);
            }
            return map;
        }
        throw new SimpleGepardException("ERROR: Cannot fetch Issue list from JIRA, status code:" + infoPage.getWebResponse().getStatusCode());
    }