use of com.serotonin.m2m2.db.dao.PointValueDao in project ma-core-public by infiniteautomation.
the class DataPointDao method getTopPointHistoryCountsNoSql.
private List<PointHistoryCount> getTopPointHistoryCountsNoSql() {
PointValueDao dao = Common.databaseProxy.newPointValueDao();
// For now we will do this the slow way
List<DataPointVO> points = getDataPoints(DataPointExtendedNameComparator.instance, false);
List<PointHistoryCount> counts = new ArrayList<>();
for (DataPointVO point : points) {
PointHistoryCount phc = new PointHistoryCount();
long count = dao.dateRangeCount(point.getId(), 0L, Long.MAX_VALUE);
phc.setCount((int) count);
phc.setPointId(point.getId());
phc.setPointName(point.getName());
counts.add(phc);
}
Collections.sort(counts, new Comparator<PointHistoryCount>() {
@Override
public int compare(PointHistoryCount count1, PointHistoryCount count2) {
return count2.getCount() - count1.getCount();
}
});
return counts;
}
Aggregations