Project

General

Profile

« Previous | Next » 

Revision 62272

getting aggregations uising the correct dsm api method

View differences:

Converter.java
402 402
        return list;
403 403
    }
404 404

  
405
    public static List<AggregationDetails> getAggregationHistoryFromJson(JSONObject datasourceInfo) throws JSONException {
406
        JSONArray rs;
405
    public static List<AggregationDetails> getAggregationHistoryFromJson(JSONArray aggregationInfo) throws JSONException {
407 406
        List<AggregationDetails> aggregationDetailsList = new ArrayList<>();
408 407

  
409
        if (datasourceInfo.get("aggregationHistory") != null && !datasourceInfo.get("aggregationHistory").toString().equals("null")) {
410
            rs = new JSONArray(datasourceInfo.get("aggregationHistory").toString());
408
        for (int i = 0; i < aggregationInfo.length(); i++)
409
            aggregationDetailsList.add(jsonToAggregationDetails(aggregationInfo.getJSONObject(i)));
411 410

  
412
            for (int i = 0; i < rs.length(); i++)
413
                aggregationDetailsList.add(jsonToAggregationDetails(rs.getJSONObject(i)));
414
        }
415

  
416 411
        return aggregationDetailsList;
417 412
    }
418 413

  
......
420 415

  
421 416
        AggregationDetails aggregationDetails = new AggregationDetails();
422 417

  
423
        aggregationDetails.setAggregationStage(aggregationObject.get("aggregationStage").toString());
424 418
        if (aggregationObject.has("collectionMode"))
425 419
            aggregationDetails.setCollectionMode(aggregationObject.get("collectionMode").toString());
426 420
        if (aggregationObject.has("indexedVersion"))
427 421
            aggregationDetails.setIndexedVersion(Boolean.parseBoolean(aggregationObject.get("indexedVersion").toString()));
422

  
423
        aggregationDetails.setAggregationStage(aggregationObject.get("aggregationStage").toString());
428 424
        aggregationDetails.setDate(convertStringToDate(aggregationObject.get("date").toString()));
429 425
        aggregationDetails.setNumberOfRecords(Integer.parseInt(aggregationObject.get("numberOfRecords").toString()));
426

  
430 427
        return aggregationDetails;
431 428
    }
432 429

  
433

  
434 430
    public static List<Timezone> toTimezones(List<String> timezones) {
435 431

  
436 432
        List<Timezone> tmz = new ArrayList<>();

Also available in: Unified diff