Search in sources :

Example 11 with PointValueDao

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;
}
Also used : DataPointVO(com.serotonin.m2m2.vo.DataPointVO) PointHistoryCount(com.serotonin.m2m2.vo.bean.PointHistoryCount) ArrayList(java.util.ArrayList)

Aggregations

PointValueDao (com.serotonin.m2m2.db.dao.PointValueDao)9 DataPointVO (com.serotonin.m2m2.vo.DataPointVO)9 PointValueTime (com.serotonin.m2m2.rt.dataImage.PointValueTime)8 AnnotatedPointValueTime (com.serotonin.m2m2.rt.dataImage.AnnotatedPointValueTime)5 DataValue (com.serotonin.m2m2.rt.dataImage.types.DataValue)5 ExportDataValue (com.serotonin.m2m2.vo.export.ExportDataValue)5 ArrayList (java.util.ArrayList)5 ExportPointInfo (com.serotonin.m2m2.vo.export.ExportPointInfo)4 DataPointDao (com.serotonin.m2m2.db.dao.DataPointDao)3 MappedRowCallback (com.serotonin.db.MappedRowCallback)2 EnhancedPointValueDao (com.serotonin.m2m2.db.dao.EnhancedPointValueDao)2 TranslatableMessage (com.serotonin.m2m2.i18n.TranslatableMessage)2 IdPointValueTime (com.serotonin.m2m2.rt.dataImage.IdPointValueTime)2 HashMap (java.util.HashMap)2 ShouldNeverHappenException (com.serotonin.ShouldNeverHappenException)1 NoSQLDao (com.serotonin.m2m2.db.dao.nosql.NoSQLDao)1 Translations (com.serotonin.m2m2.i18n.Translations)1 DataPointRT (com.serotonin.m2m2.rt.dataImage.DataPointRT)1 PointValueEmporter (com.serotonin.m2m2.rt.dataImage.PointValueEmporter)1 AlphanumericValue (com.serotonin.m2m2.rt.dataImage.types.AlphanumericValue)1