Search in sources :

Example 1 with ReportStatusEnum

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

the class SalesforceReportResultsToListConverter method convertToList.

@Converter
public static List<List<String>> convertToList(final AbstractReportResultsBase reportResults, final Exchange exchange) {
    List<List<String>> results = null;
    if (reportResults instanceof AsyncReportResults) {
        AsyncReportResults asyncReportResults = (AsyncReportResults) reportResults;
        final ReportStatusEnum status = asyncReportResults.getAttributes().getStatus();
        // only successfully completed async report results have data rows
        if (status != ReportStatusEnum.Success) {
            throw new IllegalArgumentException("Invalid asynchronous report results status " + status);
        }
    }
    switch(reportResults.getReportMetadata().getReportFormat()) {
        case TABULAR:
            results = convertTabularResults(reportResults, exchange);
            break;
        case SUMMARY:
            results = convertSummaryResults(reportResults, exchange);
            break;
        case MATRIX:
            results = convertMatrixResults(reportResults, exchange);
            break;
        default:
    }
    return results;
}
Also used : ReportStatusEnum(org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportStatusEnum) AsyncReportResults(org.apache.camel.component.salesforce.api.dto.analytics.reports.AsyncReportResults) ArrayList(java.util.ArrayList) List(java.util.List) Converter(org.apache.camel.Converter)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Converter (org.apache.camel.Converter)1 AsyncReportResults (org.apache.camel.component.salesforce.api.dto.analytics.reports.AsyncReportResults)1 ReportStatusEnum (org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportStatusEnum)1