Search in sources :

Example 1 with AggregateColumnInfo

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()]);
}
Also used : GroupingInfo(org.apache.camel.component.salesforce.api.dto.analytics.reports.GroupingInfo) ArrayList(java.util.ArrayList) AggregateColumnInfo(org.apache.camel.component.salesforce.api.dto.analytics.reports.AggregateColumnInfo) GroupingColumnInfo(org.apache.camel.component.salesforce.api.dto.analytics.reports.GroupingColumnInfo) DetailColumnInfo(org.apache.camel.component.salesforce.api.dto.analytics.reports.DetailColumnInfo)

Aggregations

ArrayList (java.util.ArrayList)1 AggregateColumnInfo (org.apache.camel.component.salesforce.api.dto.analytics.reports.AggregateColumnInfo)1 DetailColumnInfo (org.apache.camel.component.salesforce.api.dto.analytics.reports.DetailColumnInfo)1 GroupingColumnInfo (org.apache.camel.component.salesforce.api.dto.analytics.reports.GroupingColumnInfo)1 GroupingInfo (org.apache.camel.component.salesforce.api.dto.analytics.reports.GroupingInfo)1