use of org.apache.camel.dataformat.csv.CsvDataFormat in project camel by apache.
the class CsvDataFormatAutoConfiguration method configureCsvDataFormatFactory.
@Bean(name = "csv-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(CsvDataFormat.class)
public DataFormatFactory configureCsvDataFormatFactory(final CamelContext camelContext, final CsvDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
CsvDataFormat dataformat = new CsvDataFormat();
if (CamelContextAware.class.isAssignableFrom(CsvDataFormat.class)) {
CamelContextAware contextAware = CamelContextAware.class.cast(dataformat);
if (contextAware != null) {
contextAware.setCamelContext(camelContext);
}
}
try {
Map<String, Object> parameters = new HashMap<>();
IntrospectionSupport.getProperties(configuration, parameters, null, false);
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), dataformat, parameters);
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
return dataformat;
}
};
}
use of org.apache.camel.dataformat.csv.CsvDataFormat in project camel by apache.
the class AnalyticsApiIntegrationTest method doCreateRouteBuilder.
@Override
protected RouteBuilder doCreateRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
// get Report SObject by DeveloperName
from("direct:queryReport").to("salesforce:query?sObjectClass=" + QueryRecordsReport.class.getName());
from("direct:getRecentReports").to("salesforce:getRecentReports");
from("direct:getReportDescription").to("salesforce:getReportDescription");
from("direct:executeSyncReport").to("salesforce:executeSyncReport");
from("direct:executeAsyncReport").to("salesforce:executeAsyncReport?includeDetails=true");
from("direct:getReportInstances").to("salesforce:getReportInstances");
from("direct:getReportResults").to("salesforce:getReportResults");
CsvDataFormat csv = new CsvDataFormat(CSVFormat.EXCEL);
// type converter test
from("direct:convertResults").convertBodyTo(List.class).marshal(csv);
}
};
}
Aggregations