use of org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportRow in project camel by apache.
the class SalesforceReportResultsToListConverter method convertTabularResults.
private static List<List<String>> convertTabularResults(final AbstractReportResultsBase reportResults, final Exchange exchange) {
final ArrayList<List<String>> result = new ArrayList<List<String>>();
final ReportMetadata reportMetadata = reportResults.getReportMetadata();
final String[] detailColumns = reportMetadata.getDetailColumns();
final ReportExtendedMetadata reportExtendedMetadata = reportResults.getReportExtendedMetadata();
final ReportFactWithDetails factWithDetails = reportResults.getFactMap().get("T!T");
// include detail rows?
final String[] aggregates = reportMetadata.getAggregates();
if (reportResults.getHasDetailRows() && getOption(exchange, INCLUDE_DETAILS, Boolean.TRUE)) {
final int rowLength = detailColumns.length;
// include detail headers?
if (getOption(exchange, INCLUDE_HEADERS, Boolean.TRUE)) {
final List<String> headers = new ArrayList<String>(rowLength);
result.add(headers);
addColumnHeaders(headers, reportExtendedMetadata.getDetailColumnInfo(), detailColumns);
}
final ReportRow[] reportRows = factWithDetails.getRows();
result.ensureCapacity(result.size() + reportRows.length);
for (ReportRow reportRow : reportRows) {
final List<String> row = new ArrayList<String>(rowLength);
result.add(row);
addRowValues(row, reportRow.getDataCells());
}
// include summary values?
if (aggregates.length > 0 && getOption(exchange, INCLUDE_SUMMARY, Boolean.TRUE)) {
addSummaryRows(result, detailColumns, null, aggregates, factWithDetails.getAggregates());
}
} else if (aggregates.length > 0) {
final int rowLength = aggregates.length;
// include summary headers?
if (getOption(exchange, INCLUDE_HEADERS, Boolean.TRUE)) {
final List<String> headers = new ArrayList<String>(rowLength);
result.add(headers);
addColumnHeaders(headers, reportExtendedMetadata.getAggregateColumnInfo(), aggregates);
}
// add summary values
final List<String> row = new ArrayList<String>(rowLength);
result.add(row);
addRowValues(row, factWithDetails.getAggregates());
}
return result;
}
use of org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportRow in project camel by apache.
the class SalesforceReportResultsToListConverter method addDetailRows.
private static void addDetailRows(ArrayList<List<String>> result, List<String> newPrefix, ReportFactWithDetails factWithDetails) {
final ReportRow[] rows = factWithDetails.getRows();
result.ensureCapacity(result.size() + rows.length);
for (ReportRow row : rows) {
final ArrayList<String> rowValues = new ArrayList<String>(newPrefix);
addRowValues(rowValues, row.getDataCells());
result.add(rowValues);
}
}
Aggregations