Search in sources :

Example 1 with SummaryValue

use of org.apache.camel.component.salesforce.api.dto.analytics.reports.SummaryValue in project camel by apache.

the class SalesforceReportResultsToListConverter method addSummaryGroupValues.

private static void addSummaryGroupValues(ArrayList<List<String>> result, AbstractReportResultsBase reportResults, String[] columnNames, GroupingValue groupingValue, List<String> rowPrefix, boolean includeDetails, boolean includeSummary) {
    // get fact map at this level
    final ReportFactWithDetails factWithDetails = reportResults.getFactMap().get(groupingValue.getKey() + "!T");
    final List<String> newPrefix = new ArrayList<String>(rowPrefix);
    newPrefix.add(groupingValue.getLabel());
    // more groups?
    final GroupingValue[] groupings = groupingValue.getGroupings();
    if (groupings.length > 0) {
        for (GroupingValue subGroup : groupings) {
            addSummaryGroupValues(result, reportResults, columnNames, subGroup, newPrefix, includeDetails, includeSummary);
        }
    // add lowest level group detail rows?
    } else if (includeDetails) {
        addDetailRows(result, newPrefix, factWithDetails);
    // add group columns only at lowest level?
    } else if (!includeSummary) {
        result.add(newPrefix);
    }
    if (includeSummary) {
        final SummaryValue[] summaryValues = factWithDetails.getAggregates();
        final String[] aggregates = reportResults.getReportMetadata().getAggregates();
        addSummaryValues(result, includeDetails, columnNames, newPrefix, aggregates, summaryValues);
    }
}
Also used : ReportFactWithDetails(org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportFactWithDetails) ArrayList(java.util.ArrayList) SummaryValue(org.apache.camel.component.salesforce.api.dto.analytics.reports.SummaryValue) GroupingValue(org.apache.camel.component.salesforce.api.dto.analytics.reports.GroupingValue)

Aggregations

ArrayList (java.util.ArrayList)1 GroupingValue (org.apache.camel.component.salesforce.api.dto.analytics.reports.GroupingValue)1 ReportFactWithDetails (org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportFactWithDetails)1 SummaryValue (org.apache.camel.component.salesforce.api.dto.analytics.reports.SummaryValue)1