Search in sources :

Example 11 with CSVPojoWriter

use of com.serotonin.m2m2.web.mvc.rest.v1.csv.CSVPojoWriter in project ma-core-public by infiniteautomation.

the class CsvMessageConverter method writeInternal.

/* (non-Javadoc)
	 * @see org.springframework.http.converter.AbstractHttpMessageConverter#writeInternal(java.lang.Object, org.springframework.http.HttpOutputMessage)
	 */
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void writeInternal(List<AbstractRestModel<?>> records, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException {
    if (records.size() > 0) {
        CSVPojoWriter out = new CSVPojoWriter(new CSVWriter(new OutputStreamWriter(outputMessage.getBody(), Common.UTF8_CS), separator, quote));
        out.writeAll(records);
        out.close();
    }
}
Also used : CSVPojoWriter(com.serotonin.m2m2.web.mvc.rest.v1.csv.CSVPojoWriter) CSVWriter(au.com.bytecode.opencsv.CSVWriter) OutputStreamWriter(java.io.OutputStreamWriter)

Example 12 with CSVPojoWriter

use of com.serotonin.m2m2.web.mvc.rest.v1.csv.CSVPojoWriter in project ma-core-public by infiniteautomation.

the class CsvQueryArrayStreamMessageConverter method writeInternal.

/* (non-Javadoc)
	 * @see org.springframework.http.converter.AbstractHttpMessageConverter#writeInternal(java.lang.Object, org.springframework.http.HttpOutputMessage)
	 */
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void writeInternal(QueryArrayStream stream, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException {
    CSVPojoWriter out = new CSVPojoWriter(new CSVWriter(new OutputStreamWriter(outputMessage.getBody(), Common.UTF8_CS), separator, quote));
    stream.streamData(out);
    out.close();
}
Also used : CSVPojoWriter(com.serotonin.m2m2.web.mvc.rest.v1.csv.CSVPojoWriter) CSVWriter(au.com.bytecode.opencsv.CSVWriter) OutputStreamWriter(java.io.OutputStreamWriter)

Aggregations

CSVWriter (au.com.bytecode.opencsv.CSVWriter)5 DataPointVO (com.serotonin.m2m2.vo.DataPointVO)5 CSVPojoWriter (com.serotonin.m2m2.web.mvc.rest.v1.csv.CSVPojoWriter)5 OutputStreamWriter (java.io.OutputStreamWriter)5 DataValue (com.serotonin.m2m2.rt.dataImage.types.DataValue)3 BucketCalculator (com.serotonin.m2m2.view.quantize2.BucketCalculator)3 PointValueFacade (com.serotonin.m2m2.rt.dataImage.PointValueFacade)2 PointValueTime (com.serotonin.m2m2.rt.dataImage.PointValueTime)2 AbstractDataQuantizer (com.serotonin.m2m2.view.quantize2.AbstractDataQuantizer)2 IdPointValueTime (com.serotonin.m2m2.rt.dataImage.IdPointValueTime)1 AnalogStatisticsQuantizer (com.serotonin.m2m2.view.quantize2.AnalogStatisticsQuantizer)1 ValueChangeCounterQuantizer (com.serotonin.m2m2.view.quantize2.ValueChangeCounterQuantizer)1 IdPointValueStatisticsQuantizerCsvCallback (com.serotonin.m2m2.web.mvc.rest.v1.model.pointValue.statistics.IdPointValueStatisticsQuantizerCsvCallback)1 NonNumericPointValueStatisticsQuantizerCsvCallback (com.serotonin.m2m2.web.mvc.rest.v1.model.pointValue.statistics.NonNumericPointValueStatisticsQuantizerCsvCallback)1 NumericPointValueStatisticsQuantizerCsvCallback (com.serotonin.m2m2.web.mvc.rest.v1.model.pointValue.statistics.NumericPointValueStatisticsQuantizerCsvCallback)1 AnalogStatisticsChildQuantizer (com.serotonin.m2m2.web.mvc.rest.v1.statistics.AnalogStatisticsChildQuantizer)1 ParentDataQuantizer (com.serotonin.m2m2.web.mvc.rest.v1.statistics.ParentDataQuantizer)1 ValueChangeCounterChildQuantizer (com.serotonin.m2m2.web.mvc.rest.v1.statistics.ValueChangeCounterChildQuantizer)1 ArrayList (java.util.ArrayList)1