Search in sources :

Example 1 with PVTQueryCallback

use of com.infiniteautomation.mango.db.query.PVTQueryCallback in project ma-core-public by infiniteautomation.

the class PointValueDaoSQL method getPointValuesBetween.

@Override
public void getPointValuesBetween(List<Integer> ids, long from, long to, boolean orderById, Integer limit, PVTQueryCallback<IdPointValueTime> callback) {
    if (ids.size() == 0)
        return;
    if (orderById) {
        // Limit results of each data point to size limit, i.e. loop over all points and query with limit
        MutableInt counter = new MutableInt(0);
        for (Integer id : ids) {
            TimeRangeSinglePointValuesPreparedStatementCreator<PVTQueryCallback<IdPointValueTime>> c = new TimeRangeSinglePointValuesPreparedStatementCreator<PVTQueryCallback<IdPointValueTime>>(id, from, to, limit, callback, counter);
            ejt.execute(c, c);
        }
    } else {
        // Limit total results to limit
        TimeRangeMultiplePointsValuesPreparedStatementCreator<PVTQueryCallback<IdPointValueTime>> c = new TimeRangeMultiplePointsValuesPreparedStatementCreator<PVTQueryCallback<IdPointValueTime>>(ids, from, to, limit, callback);
        ejt.execute(c, c);
    }
}
Also used : MutableInt(org.apache.commons.lang3.mutable.MutableInt) IdPointValueTime(com.serotonin.m2m2.rt.dataImage.IdPointValueTime) AnnotatedIdPointValueTime(com.serotonin.m2m2.rt.dataImage.AnnotatedIdPointValueTime) PVTQueryCallback(com.infiniteautomation.mango.db.query.PVTQueryCallback)

Aggregations

PVTQueryCallback (com.infiniteautomation.mango.db.query.PVTQueryCallback)1 AnnotatedIdPointValueTime (com.serotonin.m2m2.rt.dataImage.AnnotatedIdPointValueTime)1 IdPointValueTime (com.serotonin.m2m2.rt.dataImage.IdPointValueTime)1 MutableInt (org.apache.commons.lang3.mutable.MutableInt)1