Search in sources :

Example 1 with DataPointStatisticsGenerator

use of com.infiniteautomation.mango.rest.v2.model.pointValue.quantize.DataPointStatisticsGenerator in project ma-modules-public by infiniteautomation.

the class PointValueTimeCsvWriter method writeMultiplePointStatsAtSameTime.

@Override
public void writeMultiplePointStatsAtSameTime(List<DataPointStatisticsGenerator> periodStats, long timestamp) throws IOException {
    this.jgen.writeStartObject();
    boolean first = true;
    for (DataPointStatisticsGenerator gen : periodStats) {
        if (info.isMultiplePointsPerArray()) {
            writeEntry(gen, true, first);
        } else {
            throw new ShouldNeverHappenException("Implement me?");
        }
        first = false;
    }
    this.jgen.writeEndObject();
}
Also used : DataPointStatisticsGenerator(com.infiniteautomation.mango.rest.v2.model.pointValue.quantize.DataPointStatisticsGenerator) ShouldNeverHappenException(com.serotonin.ShouldNeverHappenException)

Example 2 with DataPointStatisticsGenerator

use of com.infiniteautomation.mango.rest.v2.model.pointValue.quantize.DataPointStatisticsGenerator in project ma-modules-public by infiniteautomation.

the class PointValueTimeJsonWriter method writeMultiplePointStatsAtSameTime.

/* (non-Javadoc)
     * @see com.infiniteautomation.mango.rest.v2.model.pointValue.query.PointValueTimeWriter#writeMultipleStatsAsObject(java.util.List)
     */
@Override
public void writeMultiplePointStatsAtSameTime(List<DataPointStatisticsGenerator> periodStats, long timestamp) throws IOException {
    this.jgen.writeStartObject();
    if (info.fieldsContains(PointValueField.TIMESTAMP))
        writeTimestamp(timestamp);
    for (DataPointStatisticsGenerator gen : periodStats) {
        if (info.isMultiplePointsPerArray()) {
            DataPointVO vo = gen.getVo();
            this.jgen.writeObjectFieldStart(vo.getXid());
            writeEntry(gen, false, false);
            this.jgen.writeEndObject();
        } else {
            throw new ShouldNeverHappenException("Implement me?");
        }
    }
    this.jgen.writeEndObject();
}
Also used : DataPointVO(com.serotonin.m2m2.vo.DataPointVO) DataPointStatisticsGenerator(com.infiniteautomation.mango.rest.v2.model.pointValue.quantize.DataPointStatisticsGenerator) ShouldNeverHappenException(com.serotonin.ShouldNeverHappenException)

Aggregations

DataPointStatisticsGenerator (com.infiniteautomation.mango.rest.v2.model.pointValue.quantize.DataPointStatisticsGenerator)2 ShouldNeverHappenException (com.serotonin.ShouldNeverHappenException)2 DataPointVO (com.serotonin.m2m2.vo.DataPointVO)1