class SimpleQueryGeometryHandler implements QueryGeometryHandler {

    @Override
    public QueryGeometryResponse getQueryGeometryResponse(String id, List<? extends BaseQueryMetric> metrics) {
        QueryGeometryResponse response = new QueryGeometryResponse(id, basemaps);
        
        if (metrics != null) {
            Set<QueryGeometry> queryGeometries = new LinkedHashSet<>();
            for (BaseQueryMetric metric : metrics) {
                try {
                    boolean isLuceneQuery = isLuceneQuery(metric.getParameters());
                    String jexlQuery = (isLuceneQuery) ? toJexlQuery(metric.getQuery()) : metric.getQuery();
                    JexlNode queryNode = JexlASTHelper.parseAndFlattenJexlQuery(jexlQuery);
                    queryGeometries.addAll(GeoFeatureVisitor.getGeoFeatures(queryNode, isLuceneQuery));
                } catch (Exception e) {
                    response.addException(new Exception("Unable to parse the geo features"));
                }
            }
            response.setResult(new ArrayList<>(queryGeometries));
        }
        
        return response;
    }

}