class CommonUtils {

    public static Object buildQueryForExistingIssues(Map<String, Object> filter) {
        Map<String, Object> queryFilters = Maps.newHashMap();
        Map<String, Object> boolFilters = Maps.newHashMap();
        List<Map<String, Object>> should = getFilter(filter);
        boolFilters.put(MUST, should);
        should = Lists.newArrayList();
        Map<String, Object> term = Maps.newHashMap();
        Map<String, Object> termDetails = Maps.newHashMap();
        termDetails.put("issueStatus.keyword", "closed");
        term.put("term", termDetails);
        should.add(term);
        boolFilters.put(MUST_NOT, should);
        should = Lists.newArrayList();
        term = Maps.newHashMap();
        termDetails = Maps.newHashMap();
        termDetails.put("type.keyword", "issue");
        term.put("term", termDetails);
        should.add(term);
        boolFilters.put(SHOULD, should);
        term = Maps.newHashMap();
        termDetails = Maps.newHashMap();
        termDetails.put("type.keyword", "recommendation");
        term.put("term", termDetails);
        should.add(term);
        boolFilters.put(SHOULD, should);
        queryFilters.put(BOOL, boolFilters);
        return queryFilters;
    }

}