use of com.infiniteautomation.mango.db.tables.DataSources in project ma-core-public by infiniteautomation.
the class Upgrade44 method upgrade.
@Override
protected void upgrade() throws Exception {
DataSources table = DataSources.DATA_SOURCES;
create.createIndex("dataSourcesIdNameTypeXidIndex").on(table, table.id.asc(), table.name.asc(), table.dataSourceType.asc(), table.xid.asc()).execute();
}
use of com.infiniteautomation.mango.db.tables.DataSources in project ma-core-public by infiniteautomation.
the class PointValueDaoSQL method topPointHistoryCounts.
@Override
public List<PointHistoryCount> topPointHistoryCounts(int limit) {
PointValueDao.validateLimit(limit);
DataPoints points = DataPoints.DATA_POINTS;
DataSources dataSources = DataSources.DATA_SOURCES;
Field<Integer> count = DSL.count().as("count");
return create.select(count).select(dataPointDao.getSelectFields()).from(pv).innerJoin(points).on(points.id.eq(pv.dataPointId)).leftJoin(dataSources).on(dataSources.id.eq(points.dataSourceId)).groupBy(points.id, dataSources.name, dataSources.xid, dataSources.dataSourceType).orderBy(count.desc()).limit(limit).fetch(record -> {
DataPointVO point = dataPointDao.mapRecord(record);
dataPointDao.loadRelationalData(point);
return new PointHistoryCount(point, record.get(count));
});
}
use of com.infiniteautomation.mango.db.tables.DataSources in project ma-core-public by infiniteautomation.
the class DataPointDao method createFieldMap.
@Override
protected Map<String, Field<?>> createFieldMap() {
Map<String, Field<?>> fields = super.createFieldMap();
fields.put("dataType", table.dataTypeId);
DataSources dataSources = DataSources.DATA_SOURCES;
fields.put("dataSourceName", dataSources.name);
fields.put("dataSourceXid", dataSources.xid);
fields.put("dataSourceType", dataSources.dataSourceType);
return fields;
}
Aggregations