Merge branch 'master' into 'master'

Sort device analytics data

Closes product-iots#140

See merge request entgra/carbon-device-mgt!238
3.x.x
Charitha Goonetilleke 5 years ago
commit 11e6e11714

@ -106,7 +106,9 @@ public class DeviceEventManagementServiceImpl implements DeviceEventManagementSe
List<String> recordIds = getRecordIds(resultEntries); List<String> recordIds = getRecordIds(resultEntries);
AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, null, recordIds); AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, null, recordIds);
eventRecords.setCount(eventCount); eventRecords.setCount(eventCount);
eventRecords.setList(AnalyticsDataAPIUtil.listRecords(analyticsDataAPI, response)); List<Record> records = AnalyticsDataAPIUtil.listRecords(analyticsDataAPI, response);
records.sort((Record r1, Record r2) -> Long.compare(r2.getTimestamp(), r1.getTimestamp()));
eventRecords.setList(records);
return eventRecords; return eventRecords;
} }

Loading…
Cancel
Save