Revision 49935
Added by Panagiotis Kanakakis over 6 years ago
Converter.java | ||
---|---|---|
239 | 239 |
|
240 | 240 |
public static List<AggregationDetails> getAggregationHistoryFromJson(JSONObject repositoryObject) throws JSONException { |
241 | 241 |
|
242 |
if( repositoryObject.get("aggregationHistory").toString().equals("[]")) |
|
242 |
if( repositoryObject.get("aggregationHistory").toString().equals("[]") || |
|
243 |
repositoryObject.get("aggregationHistory")!= null) |
|
243 | 244 |
return null; |
244 | 245 |
|
246 |
|
|
245 | 247 |
JSONArray rs = new JSONArray(repositoryObject.get("aggregationHistory").toString()); |
246 | 248 |
List<AggregationDetails> aggregationDetailsList = new ArrayList<>(); |
247 | 249 |
for(int i=0;i<rs.length();i++) |
... | ... | |
253 | 255 |
|
254 | 256 |
AggregationDetails aggregationDetails = new AggregationDetails(); |
255 | 257 |
aggregationDetails.setAggregationStage(aggregationObject.get("aggregationStage").toString()); |
256 |
aggregationDetails.setCollectionMode(aggregationObject.get("collectionMode").toString()); |
|
258 |
//aggregationDetails.setCollectionMode(aggregationObject.get("collectionMode").toString());
|
|
257 | 259 |
aggregationDetails.setDate(convertStringToDate(aggregationObject.get("date").toString())); |
258 | 260 |
aggregationDetails.setNumberOfRecords(Integer.parseInt(aggregationObject.get("numberOfRecords").toString())); |
259 | 261 |
return aggregationDetails; |
Also available in: Unified diff
1. Test aggregation method.
2. Bug fix on convertion from json to interface object.