Search in sources :

Example 1 with AbstractReportResultsBase

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

the class AnalyticsApiProcessor method processExecuteSyncReport.

private void processExecuteSyncReport(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
    String reportId;
    final Boolean includeDetails = getParameter(INCLUDE_DETAILS, exchange, IGNORE_BODY, IS_OPTIONAL, Boolean.class);
    // try getting report metadata from body first
    ReportMetadata reportMetadata = exchange.getIn().getBody(ReportMetadata.class);
    if (reportMetadata != null) {
        reportId = reportMetadata.getId();
        if (reportId == null) {
            reportId = getParameter(REPORT_ID, exchange, IGNORE_BODY, NOT_OPTIONAL);
        }
    } else {
        reportId = getParameter(REPORT_ID, exchange, USE_BODY, NOT_OPTIONAL);
        reportMetadata = getParameter(REPORT_METADATA, exchange, IGNORE_BODY, IS_OPTIONAL, ReportMetadata.class);
    }
    analyticsClient.executeSyncReport(reportId, includeDetails, reportMetadata, new AnalyticsApiClient.ReportResultsResponseCallback() {

        @Override
        public void onResponse(AbstractReportResultsBase reportResults, SalesforceException ex) {
            processResponse(exchange, reportResults, ex, callback);
        }
    });
}
Also used : SalesforceException(org.apache.camel.component.salesforce.api.SalesforceException) AnalyticsApiClient(org.apache.camel.component.salesforce.internal.client.AnalyticsApiClient) DefaultAnalyticsApiClient(org.apache.camel.component.salesforce.internal.client.DefaultAnalyticsApiClient) AbstractReportResultsBase(org.apache.camel.component.salesforce.api.dto.analytics.reports.AbstractReportResultsBase) ReportMetadata(org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportMetadata)

Aggregations

SalesforceException (org.apache.camel.component.salesforce.api.SalesforceException)1 AbstractReportResultsBase (org.apache.camel.component.salesforce.api.dto.analytics.reports.AbstractReportResultsBase)1 ReportMetadata (org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportMetadata)1 AnalyticsApiClient (org.apache.camel.component.salesforce.internal.client.AnalyticsApiClient)1 DefaultAnalyticsApiClient (org.apache.camel.component.salesforce.internal.client.DefaultAnalyticsApiClient)1