use of org.apache.camel.component.salesforce.api.dto.analytics.reports.AggregateColumnInfo in project camel by apache.
the class SalesforceReportResultsToListConverter method getResultColumns.
private static String[] getResultColumns(List<DetailColumnInfo> result, ReportMetadata reportMetadata, ReportExtendedMetadata reportExtendedMetadata, boolean includeDetails, boolean includeSummary) {
final List<String> columnNames = new ArrayList<String>();
// add grouping columns before detail columns
final Map<String, GroupingColumnInfo> groupingColumnInfos = reportExtendedMetadata.getGroupingColumnInfo();
for (GroupingInfo downGroup : reportMetadata.getGroupingsDown()) {
final String name = downGroup.getName();
columnNames.add(name);
result.add(groupingColumnInfos.get(name));
}
for (GroupingInfo acrossGroup : reportMetadata.getGroupingsAcross()) {
final String name = acrossGroup.getName();
columnNames.add(name);
result.add(groupingColumnInfos.get(name));
}
// include details?
if (!includeDetails) {
// include summary columns?
if (includeSummary) {
final Map<String, AggregateColumnInfo> aggregateColumnInfos = reportExtendedMetadata.getAggregateColumnInfo();
for (String aggregateColumnName : reportMetadata.getAggregates()) {
columnNames.add(aggregateColumnName);
result.add(aggregateColumnInfos.get(aggregateColumnName));
}
}
} else {
// add detail columns
final Map<String, DetailColumnInfo> detailColumnInfo = reportExtendedMetadata.getDetailColumnInfo();
for (String columnName : reportMetadata.getDetailColumns()) {
columnNames.add(columnName);
result.add(detailColumnInfo.get(columnName));
}
}
return columnNames.toArray(new String[columnNames.size()]);
}
Aggregations