You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dh...@apache.org on 2015/06/25 05:35:51 UTC
[3/8] camel git commit: CAMEL-8397: Added support for Salesforce1
Anayltics reporting API, minor refactor,
added missing Salesforce fields for latest API
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportExtendedMetadata.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportExtendedMetadata.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportExtendedMetadata.java
new file mode 100644
index 0000000..b1f039b
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportExtendedMetadata.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+import java.util.Map;
+
+import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
+
+/**
+ * Report results extended metadata.
+ */
+public class ReportExtendedMetadata extends AbstractDTOBase {
+
+ private Map<String, GroupingColumnInfo> groupingColumnInfo;
+ private Map<String, DetailColumnInfo> detailColumnInfo;
+ private Map<String, AggregateColumnInfo> aggregateColumnInfo;
+
+ public Map<String, GroupingColumnInfo> getGroupingColumnInfo() {
+ return groupingColumnInfo;
+ }
+
+ public void setGroupingColumnInfo(Map<String, GroupingColumnInfo> groupingColumnInfo) {
+ this.groupingColumnInfo = groupingColumnInfo;
+ }
+
+ public Map<String, DetailColumnInfo> getDetailColumnInfo() {
+ return detailColumnInfo;
+ }
+
+ public void setDetailColumnInfo(Map<String, DetailColumnInfo> detailColumnInfo) {
+ this.detailColumnInfo = detailColumnInfo;
+ }
+
+ public Map<String, AggregateColumnInfo> getAggregateColumnInfo() {
+ return aggregateColumnInfo;
+ }
+
+ public void setAggregateColumnInfo(Map<String, AggregateColumnInfo> aggregateColumnInfo) {
+ this.aggregateColumnInfo = aggregateColumnInfo;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportFactWithDetails.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportFactWithDetails.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportFactWithDetails.java
new file mode 100644
index 0000000..bf600ae
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportFactWithDetails.java
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
+
+/**
+ * Report results fact with details.
+ */
+public class ReportFactWithDetails extends AbstractDTOBase {
+
+ private ReportRow[] rows;
+ private SummaryValue[] aggregates;
+
+ public ReportRow[] getRows() {
+ return rows;
+ }
+
+ public void setRows(ReportRow[] rows) {
+ this.rows = rows;
+ }
+
+ public SummaryValue[] getAggregates() {
+ return aggregates;
+ }
+
+ public void setAggregates(SummaryValue[] aggregates) {
+ this.aggregates = aggregates;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportFilter.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportFilter.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportFilter.java
new file mode 100644
index 0000000..17aa9cf
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportFilter.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
+
+/**
+ * Report filter details DTO.
+ */
+public class ReportFilter extends AbstractDTOBase {
+
+ private String value;
+ private String column;
+ private String operator;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getColumn() {
+ return column;
+ }
+
+ public void setColumn(String column) {
+ this.column = column;
+ }
+
+ public String getOperator() {
+ return operator;
+ }
+
+ public void setOperator(String operator) {
+ this.operator = operator;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportFormatEnum.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportFormatEnum.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportFormatEnum.java
new file mode 100644
index 0000000..744b236
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportFormatEnum.java
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+/**
+ * Report format enumeration.
+ */
+public enum ReportFormatEnum {
+ TABULAR, SUMMARY, MATRIX
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportInstance.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportInstance.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportInstance.java
new file mode 100644
index 0000000..f69ae8d
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportInstance.java
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
+import org.joda.time.DateTime;
+
+/**
+ * Report instance DTO.
+ */
+public class ReportInstance extends AbstractDTOBase {
+
+ private String id;
+ private ReportStatusEnum status;
+ private String url;
+ private String ownerId;
+ private Boolean hasDetailRows;
+ private DateTime completionDate;
+ private DateTime requestDate;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ReportStatusEnum getStatus() {
+ return status;
+ }
+
+ public void setStatus(ReportStatusEnum status) {
+ this.status = status;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getOwnerId() {
+ return ownerId;
+ }
+
+ public void setOwnerId(String ownerId) {
+ this.ownerId = ownerId;
+ }
+
+ public Boolean getHasDetailRows() {
+ return hasDetailRows;
+ }
+
+ public void setHasDetailRows(Boolean hasDetailRows) {
+ this.hasDetailRows = hasDetailRows;
+ }
+
+ public DateTime getCompletionDate() {
+ return completionDate;
+ }
+
+ public void setCompletionDate(DateTime completionDate) {
+ this.completionDate = completionDate;
+ }
+
+ public DateTime getRequestDate() {
+ return requestDate;
+ }
+
+ public void setRequestDate(DateTime requestDate) {
+ this.requestDate = requestDate;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportMetadata.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportMetadata.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportMetadata.java
new file mode 100644
index 0000000..1ad0cff
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportMetadata.java
@@ -0,0 +1,143 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
+
+/**
+ * Report metadata DTO.
+ */
+public class ReportMetadata extends AbstractDTOBase {
+
+ private String name;
+ private String id;
+ private String currency;
+ private ReportFormatEnum reportFormat;
+ private String developerName;
+ private ReportType reportType;
+ private String[] aggregates;
+ private GroupingInfo[] groupingsDown;
+ private GroupingInfo[] groupingsAcross;
+ private String reportBooleanFilter;
+ private ReportFilter[] reportFilters;
+ private String[] detailColumns;
+ private String[] historicalSnapshotDates;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public ReportFormatEnum getReportFormat() {
+ return reportFormat;
+ }
+
+ public void setReportFormat(ReportFormatEnum reportFormat) {
+ this.reportFormat = reportFormat;
+ }
+
+ public String getDeveloperName() {
+ return developerName;
+ }
+
+ public void setDeveloperName(String developerName) {
+ this.developerName = developerName;
+ }
+
+ public ReportType getReportType() {
+ return reportType;
+ }
+
+ public void setReportType(ReportType reportType) {
+ this.reportType = reportType;
+ }
+
+ public String[] getAggregates() {
+ return aggregates;
+ }
+
+ public void setAggregates(String[] aggregates) {
+ this.aggregates = aggregates;
+ }
+
+ public GroupingInfo[] getGroupingsDown() {
+ return groupingsDown;
+ }
+
+ public void setGroupingsDown(GroupingInfo[] groupingsDown) {
+ this.groupingsDown = groupingsDown;
+ }
+
+ public GroupingInfo[] getGroupingsAcross() {
+ return groupingsAcross;
+ }
+
+ public void setGroupingsAcross(GroupingInfo[] groupingsAcross) {
+ this.groupingsAcross = groupingsAcross;
+ }
+
+ public String getReportBooleanFilter() {
+ return reportBooleanFilter;
+ }
+
+ public void setReportBooleanFilter(String reportBooleanFilter) {
+ this.reportBooleanFilter = reportBooleanFilter;
+ }
+
+ public ReportFilter[] getReportFilters() {
+ return reportFilters;
+ }
+
+ public void setReportFilters(ReportFilter[] reportFilters) {
+ this.reportFilters = reportFilters;
+ }
+
+ public String[] getDetailColumns() {
+ return detailColumns;
+ }
+
+ public void setDetailColumns(String[] detailColumns) {
+ this.detailColumns = detailColumns;
+ }
+
+ public String[] getHistoricalSnapshotDates() {
+ return historicalSnapshotDates;
+ }
+
+ public void setHistoricalSnapshotDates(String[] historicalSnapshotDates) {
+ this.historicalSnapshotDates = historicalSnapshotDates;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportRow.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportRow.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportRow.java
new file mode 100644
index 0000000..5349dcc
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportRow.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
+
+/**
+ * Reports fact map row.
+ */
+public class ReportRow extends AbstractDTOBase {
+
+ private SummaryValue[] dataCells;
+
+ public SummaryValue[] getDataCells() {
+ return dataCells;
+ }
+
+ public void setDataCells(SummaryValue[] dataCells) {
+ this.dataCells = dataCells;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportStatusEnum.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportStatusEnum.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportStatusEnum.java
new file mode 100644
index 0000000..871aa8e
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportStatusEnum.java
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+/**
+ * Report status enumeration.
+ */
+public enum ReportStatusEnum {
+ New, Success, Running, Error
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportType.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportType.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportType.java
new file mode 100644
index 0000000..9fd8b90
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportType.java
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
+
+/**
+ * Report type DTO.
+ */
+public class ReportType extends AbstractDTOBase {
+
+ private String type;
+ private String label;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportTypeColumn.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportTypeColumn.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportTypeColumn.java
new file mode 100644
index 0000000..b1f933b
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportTypeColumn.java
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
+
+/**
+ * Report categories columns.
+ */
+public class ReportTypeColumn extends AbstractDTOBase {
+
+ private String label;
+ private FilterValue[] filterValues;
+ private String dataType;
+ private Boolean filterable;
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public FilterValue[] getFilterValues() {
+ return filterValues;
+ }
+
+ public void setFilterValues(FilterValue[] filterValues) {
+ this.filterValues = filterValues;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public Boolean getFilterable() {
+ return filterable;
+ }
+
+ public void setFilterable(Boolean filterable) {
+ this.filterable = filterable;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportTypeColumnCategory.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportTypeColumnCategory.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportTypeColumnCategory.java
new file mode 100644
index 0000000..fcd5c49
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportTypeColumnCategory.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+import java.util.Map;
+
+import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
+
+/**
+ * Report type metadata categories DTO.
+ */
+public class ReportTypeColumnCategory extends AbstractDTOBase {
+
+ private String label;
+ private Map<String, ReportTypeColumn> columns;
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public Map<String, ReportTypeColumn> getColumns() {
+ return columns;
+ }
+
+ public void setColumns(Map<String, ReportTypeColumn> columns) {
+ this.columns = columns;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportTypeMetadata.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportTypeMetadata.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportTypeMetadata.java
new file mode 100644
index 0000000..9d849c8
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/ReportTypeMetadata.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
+
+/**
+ * Report description report type DTO.
+ */
+public class ReportTypeMetadata extends AbstractDTOBase {
+
+ private ReportTypeColumnCategory[] categories;
+ private Map<String, List<FilterOperator>> dataTypeFilterOperatorMap;
+
+ public ReportTypeColumnCategory[] getCategories() {
+ return categories;
+ }
+
+ public void setCategories(ReportTypeColumnCategory[] categories) {
+ this.categories = categories;
+ }
+
+ public Map<String, List<FilterOperator>> getDataTypeFilterOperatorMap() {
+ return dataTypeFilterOperatorMap;
+ }
+
+ public void setDataTypeFilterOperatorMap(Map<String, List<FilterOperator>> dataTypeFilterOperatorMap) {
+ this.dataTypeFilterOperatorMap = dataTypeFilterOperatorMap;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/SummaryValue.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/SummaryValue.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/SummaryValue.java
new file mode 100644
index 0000000..34127c7
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/SummaryValue.java
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
+import org.codehaus.jackson.annotate.JsonAnySetter;
+
+/**
+ * Report results summary value DTO for data cells and aggregates.
+ */
+public class SummaryValue extends AbstractDTOBase {
+
+ public static final String VALUE_FIELD = "value";
+
+ private String label;
+
+ private Object value;
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ /**
+ * Helper method for JSON un-marshaling.
+ * @param name field name, MUST be "value"
+ * @param value field value
+ * @throws java.lang.IllegalArgumentException if field name is not "value"
+ */
+ @JsonAnySetter
+ public void setAny(String name, Object value) throws IllegalArgumentException {
+ if (!VALUE_FIELD.equals(name)) {
+ throw new IllegalArgumentException(name);
+ }
+ this.value = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/SyncAttributes.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/SyncAttributes.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/SyncAttributes.java
new file mode 100644
index 0000000..b2cc08d
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/SyncAttributes.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+/**
+ * Report results Attributes.
+ */
+public class SyncAttributes extends AbstractAttributesBase {
+
+ private String describeUrl;
+ private String instancesUrl;
+
+ public String getDescribeUrl() {
+ return describeUrl;
+ }
+
+ public void setDescribeUrl(String describeUrl) {
+ this.describeUrl = describeUrl;
+ }
+
+ public String getInstancesUrl() {
+ return instancesUrl;
+ }
+
+ public void setInstancesUrl(String instancesUrl) {
+ this.instancesUrl = instancesUrl;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/SyncReportResults.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/SyncReportResults.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/SyncReportResults.java
new file mode 100644
index 0000000..dead5e9
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/analytics/reports/SyncReportResults.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.dto.analytics.reports;
+
+/**
+ * Sync Report results DTO.
+ */
+public class SyncReportResults extends AbstractReportResultsBase {
+
+ private SyncAttributes attributes;
+
+ public SyncAttributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(SyncAttributes attributes) {
+ this.attributes = attributes;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/OperationName.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/OperationName.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/OperationName.java
index a5b7893..efe09ce 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/OperationName.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/OperationName.java
@@ -49,7 +49,15 @@ public enum OperationName {
GET_RESULTS("getResults"),
CREATE_BATCH_QUERY("createBatchQuery"),
GET_QUERY_RESULT_IDS("getQueryResultIds"),
- GET_QUERY_RESULT("getQueryResult");
+ GET_QUERY_RESULT("getQueryResult"),
+
+ // analytics API
+ GET_RECENT_REPORTS("getRecentReports"),
+ GET_REPORT_DESCRIPTION("getReportDescription"),
+ EXECUTE_SYNCREPORT("executeSyncReport"),
+ EXECUTE_ASYNCREPORT("executeAsyncReport"),
+ GET_REPORT_INSTANCES("getReportInstances"),
+ GET_REPORT_RESULTS("getReportResults");
private final String value;
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AnalyticsApiClient.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AnalyticsApiClient.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AnalyticsApiClient.java
new file mode 100644
index 0000000..b40c8bb
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AnalyticsApiClient.java
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.internal.client;
+
+import java.util.List;
+
+import org.apache.camel.component.salesforce.api.SalesforceException;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.AbstractReportResultsBase;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.RecentReport;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportDescription;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportInstance;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportMetadata;
+
+/**
+ * Client interface for Analytics API.
+ */
+public interface AnalyticsApiClient {
+
+ // Report operations
+
+ public interface RecentReportsResponseCallback {
+ void onResponse(List<RecentReport> reportDescription, SalesforceException ex);
+ }
+
+ public interface ReportDescriptionResponseCallback {
+ void onResponse(ReportDescription reportDescription, SalesforceException ex);
+ }
+
+ public interface ReportResultsResponseCallback {
+ void onResponse(AbstractReportResultsBase reportResults, SalesforceException ex);
+ }
+
+ public interface ReportInstanceResponseCallback {
+ void onResponse(ReportInstance reportInstance, SalesforceException ex);
+ }
+
+ public interface ReportInstanceListResponseCallback {
+ void onResponse(List<ReportInstance> reportInstances, SalesforceException ex);
+ }
+
+ void getRecentReports(RecentReportsResponseCallback callback);
+
+ void getReportDescription(String reportId,
+ ReportDescriptionResponseCallback callback);
+
+ void executeSyncReport(String reportId, Boolean includeDetails, ReportMetadata reportFilter,
+ ReportResultsResponseCallback callback);
+
+ void executeAsyncReport(String reportId, Boolean includeDetails, ReportMetadata reportFilter,
+ ReportInstanceResponseCallback callback);
+
+ void getReportInstances(String reportId,
+ ReportInstanceListResponseCallback callback);
+
+ void getReportResults(String reportId, String instanceId,
+ ReportResultsResponseCallback callback);
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultAnalyticsApiClient.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultAnalyticsApiClient.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultAnalyticsApiClient.java
new file mode 100644
index 0000000..1041f7f
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultAnalyticsApiClient.java
@@ -0,0 +1,339 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.internal.client;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.camel.component.salesforce.api.SalesforceException;
+import org.apache.camel.component.salesforce.api.dto.RestError;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.AsyncReportResults;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.RecentReport;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportDescription;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportInstance;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportMetadata;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.SyncReportResults;
+import org.apache.camel.component.salesforce.internal.SalesforceSession;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.type.TypeReference;
+import org.eclipse.jetty.client.ContentExchange;
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.client.HttpExchange;
+import org.eclipse.jetty.http.HttpHeaders;
+import org.eclipse.jetty.http.HttpMethods;
+import org.eclipse.jetty.io.ByteArrayBuffer;
+import org.eclipse.jetty.util.StringUtil;
+
+/**
+ * Default implementation of {@link org.apache.camel.component.salesforce.internal.client.AnalyticsApiClient}.
+ */
+public class DefaultAnalyticsApiClient extends AbstractClientBase implements AnalyticsApiClient {
+
+ private static final String TOKEN_PREFIX = "Bearer ";
+ private static final String INCLUDE_DETAILS_QUERY_PARAM = "?includeDetails=";
+ private ObjectMapper objectMapper;
+
+
+ public DefaultAnalyticsApiClient(String version, SalesforceSession session, HttpClient httpClient) throws SalesforceException {
+ super(version, session, httpClient);
+
+ objectMapper = new ObjectMapper();
+ }
+
+ @Override
+ public void getRecentReports(final RecentReportsResponseCallback callback) {
+
+ final ContentExchange contentExchange = getContentExchange(HttpMethods.GET, reportsUrl());
+
+ doHttpRequest(contentExchange, new ClientResponseCallback() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public void onResponse(InputStream response, SalesforceException ex) {
+ List<RecentReport> recentReports = null;
+ if (response != null) {
+ try {
+ recentReports = unmarshalResponse(response, contentExchange,
+ new TypeReference<List<RecentReport>>() {
+ }
+ );
+ } catch (SalesforceException e) {
+ ex = e;
+ }
+ }
+ callback.onResponse(recentReports, ex);
+ }
+ });
+ }
+
+ @Override
+ public void getReportDescription(String reportId, final ReportDescriptionResponseCallback callback) {
+
+ final ContentExchange contentExchange = getContentExchange(HttpMethods.GET, reportsDescribeUrl(reportId));
+
+ doHttpRequest(contentExchange, new ClientResponseCallback() {
+ @Override
+ public void onResponse(InputStream response, SalesforceException ex) {
+ ReportDescription reportDescription = null;
+ try {
+ reportDescription = unmarshalResponse(response, contentExchange, ReportDescription.class);
+ } catch (SalesforceException e) {
+ ex = e;
+ }
+ callback.onResponse(reportDescription, ex);
+ }
+ });
+ }
+
+ @Override
+ public void executeSyncReport(String reportId, Boolean includeDetails, ReportMetadata reportMetadata,
+ final ReportResultsResponseCallback callback) {
+
+ final boolean useGet = reportMetadata == null;
+ final ContentExchange contentExchange = getContentExchange(
+ useGet ? HttpMethods.GET : HttpMethods.POST, reportsUrl(reportId, includeDetails));
+
+ // set POST data
+ if (!useGet) {
+ try {
+ // wrap reportMetadata in a map
+ final HashMap<String, Object> request = new HashMap<String, Object>();
+ request.put("reportMetadata", reportMetadata);
+ marshalRequest(request, contentExchange);
+ } catch (SalesforceException e) {
+ callback.onResponse(null, e);
+ return;
+ }
+ }
+
+ doHttpRequest(contentExchange, new ClientResponseCallback() {
+ @Override
+ public void onResponse(InputStream response, SalesforceException ex) {
+ SyncReportResults reportResults = null;
+ try {
+ reportResults = unmarshalResponse(response, contentExchange, SyncReportResults.class);
+ } catch (SalesforceException e) {
+ ex = e;
+ }
+ callback.onResponse(reportResults, ex);
+ }
+ });
+ }
+
+ @Override
+ public void executeAsyncReport(String reportId, Boolean includeDetails, ReportMetadata reportMetadata,
+ final ReportInstanceResponseCallback callback) {
+
+ final ContentExchange contentExchange = getContentExchange(HttpMethods.POST,
+ reportInstancesUrl(reportId, includeDetails));
+
+ // set POST data
+ if (reportMetadata != null) {
+ try {
+ // wrap reportMetadata in a map
+ final HashMap<String, Object> request = new HashMap<String, Object>();
+ request.put("reportMetadata", reportMetadata);
+ marshalRequest(request, contentExchange);
+ } catch (SalesforceException e) {
+ callback.onResponse(null, e);
+ return;
+ }
+ }
+
+ doHttpRequest(contentExchange, new ClientResponseCallback() {
+ @Override
+ public void onResponse(InputStream response, SalesforceException ex) {
+ ReportInstance reportInstance = null;
+ try {
+ reportInstance = unmarshalResponse(response, contentExchange, ReportInstance.class);
+ } catch (SalesforceException e) {
+ ex = e;
+ }
+ callback.onResponse(reportInstance, ex);
+ }
+ });
+ }
+
+ @Override
+ public void getReportInstances(String reportId, final ReportInstanceListResponseCallback callback) {
+
+ final ContentExchange contentExchange = getContentExchange(HttpMethods.GET, reportInstancesUrl(reportId));
+
+ doHttpRequest(contentExchange, new ClientResponseCallback() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public void onResponse(InputStream response, SalesforceException ex) {
+ List<ReportInstance> reportInstances = null;
+ if (response != null) {
+ try {
+ reportInstances = unmarshalResponse(response, contentExchange,
+ new TypeReference<List<ReportInstance>>() {
+ }
+ );
+ } catch (SalesforceException e) {
+ ex = e;
+ }
+ }
+ callback.onResponse(reportInstances, ex);
+ }
+ });
+ }
+
+ @Override
+ public void getReportResults(String reportId, String instanceId, final ReportResultsResponseCallback callback) {
+
+ final ContentExchange contentExchange = getContentExchange(HttpMethods.GET,
+ reportInstancesUrl(reportId, instanceId));
+
+ doHttpRequest(contentExchange, new ClientResponseCallback() {
+ @Override
+ public void onResponse(InputStream response, SalesforceException ex) {
+ AsyncReportResults reportResults = null;
+ try {
+ reportResults = unmarshalResponse(response, contentExchange, AsyncReportResults.class);
+ } catch (SalesforceException e) {
+ ex = e;
+ }
+ callback.onResponse(reportResults, ex);
+ }
+ });
+ }
+
+ private String reportsUrl() {
+ // NOTE the prefix 'v' for the version number
+ return instanceUrl + "/services/data/v" + version + "/analytics/reports";
+ }
+
+ private String reportsDescribeUrl(String reportId) {
+ return reportsUrl(reportId) + "/describe";
+ }
+
+ private String reportsUrl(String reportId) {
+ return reportsUrl() + "/" + reportId;
+ }
+
+ private String reportsUrl(String reportId, Boolean includeDetails) {
+ return includeDetails == null ? reportsUrl(reportId)
+ : reportsUrl(reportId) + INCLUDE_DETAILS_QUERY_PARAM + includeDetails;
+ }
+
+ private String reportInstancesUrl(String reportId) {
+ return reportsUrl(reportId) + "/instances";
+ }
+
+ private String reportInstancesUrl(String reportId, Boolean includeDetails) {
+ return includeDetails == null ? reportInstancesUrl(reportId)
+ : reportInstancesUrl(reportId) + INCLUDE_DETAILS_QUERY_PARAM + includeDetails;
+ }
+
+ private String reportInstancesUrl(String reportId, String instanceId) {
+ return reportInstancesUrl(reportId) + "/" + instanceId;
+ }
+
+ @Override
+ protected void setAccessToken(HttpExchange httpExchange) {
+ httpExchange.setRequestHeader(HttpHeaders.AUTHORIZATION, TOKEN_PREFIX + accessToken);
+ }
+
+ @Override
+ protected SalesforceException createRestException(ContentExchange httpExchange, String reason) {
+ final int statusCode = httpExchange.getResponseStatus();
+ String responseContent = null;
+ try {
+ responseContent = httpExchange.getResponseContent();
+ if (responseContent != null) {
+ // unmarshal RestError
+ final List<RestError> errors = objectMapper.readValue(responseContent,
+ new TypeReference<List<RestError>>() {
+ });
+ return new SalesforceException(errors, statusCode);
+ }
+ } catch (UnsupportedEncodingException e) {
+ // log and ignore
+ String msg = "Unexpected Error parsing JSON error response body + ["
+ + responseContent + "] : " + e.getMessage();
+ log.warn(msg, e);
+ } catch (IOException e) {
+ // log and ignore
+ String msg = "Unexpected Error parsing JSON error response body + ["
+ + responseContent + "] : " + e.getMessage();
+ log.warn(msg, e);
+ }
+
+ // just report HTTP status info
+ return new SalesforceException("Unexpected error: " + reason + ", with content: " + responseContent,
+ statusCode);
+ }
+
+ @Override
+ protected void doHttpRequest(ContentExchange request, ClientResponseCallback callback) {
+
+ // set access token for all requests
+ setAccessToken(request);
+
+ // set request and response content type and charset, which is always JSON for analytics API
+ request.setRequestHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON_UTF8);
+ request.setRequestHeader(HttpHeaders.ACCEPT, APPLICATION_JSON_UTF8);
+ request.setRequestHeader(HttpHeaders.ACCEPT_CHARSET, StringUtil.__UTF8);
+
+ super.doHttpRequest(request, callback);
+ }
+
+ private void marshalRequest(Object input, ContentExchange request) throws SalesforceException {
+ try {
+ request.setRequestContent(new ByteArrayBuffer(objectMapper.writeValueAsBytes(input)));
+ } catch (IOException e) {
+ throw new SalesforceException(
+ String.format("Error marshaling request for {%s:%s} : %s",
+ request.getMethod(), request.getRequestURI(), e.getMessage()),
+ e);
+ }
+ }
+
+ private <T> T unmarshalResponse(InputStream response, ContentExchange request,
+ TypeReference<T> responseTypeReference)
+ throws SalesforceException {
+
+ try {
+ return objectMapper.readValue(response, responseTypeReference);
+ } catch (IOException e) {
+ throw new SalesforceException(
+ String.format("Error unmarshaling response {%s:%s} : %s",
+ request.getMethod(), request.getRequestURI(), e.getMessage()),
+ e);
+ }
+ }
+
+ private <T> T unmarshalResponse(InputStream response, ContentExchange request, Class<T> responseClass)
+ throws SalesforceException {
+
+ if (response == null) {
+ return null;
+ }
+
+ try {
+ return objectMapper.readValue(response, responseClass);
+ } catch (IOException e) {
+ throw new SalesforceException(
+ String.format("Error unmarshaling response {%s:%s} : %s",
+ request.getMethod(), request.getRequestURI(), e.getMessage()),
+ e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java
index 834ea51..352005a 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java
@@ -64,7 +64,7 @@ public abstract class AbstractRestProcessor extends AbstractSalesforceProcessor
final PayloadFormat payloadFormat = endpoint.getConfiguration().getFormat();
- this.restClient = new DefaultRestClient(httpClient, endpointConfigMap.get(API_VERSION),
+ this.restClient = new DefaultRestClient(httpClient, (String) endpointConfigMap.get(API_VERSION),
payloadFormat, session);
this.classMap = endpoint.getComponent().getClassMap();
@@ -151,19 +151,19 @@ public abstract class AbstractRestProcessor extends AbstractSalesforceProcessor
processApexCall(exchange, callback);
break;
default:
- throw new SalesforceException("Unknow operation name: " + operationName, null);
+ throw new SalesforceException("Unknown operation name: " + operationName.value(), null);
}
} catch (SalesforceException e) {
exchange.setException(new SalesforceException(
String.format("Error processing %s: [%s] \"%s\"",
- operationName, e.getStatusCode(), e.getMessage()),
+ operationName.value(), e.getStatusCode(), e.getMessage()),
e));
callback.done(true);
return true;
} catch (RuntimeException e) {
exchange.setException(new SalesforceException(
String.format("Unexpected Error processing %s: \"%s\"",
- operationName, e.getMessage()),
+ operationName.value(), e.getMessage()),
e));
callback.done(true);
return true;
@@ -446,7 +446,7 @@ public abstract class AbstractRestProcessor extends AbstractSalesforceProcessor
private void processQuery(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
final String sObjectQuery = getParameter(SOBJECT_QUERY, exchange, USE_BODY, NOT_OPTIONAL);
- // use sObject name to load class
+ // use custom response class property
setResponseClass(exchange, null);
restClient.query(sObjectQuery, new RestClient.ResponseCallback() {
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractSalesforceProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractSalesforceProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractSalesforceProcessor.java
index db5c66b..151d24d 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractSalesforceProcessor.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractSalesforceProcessor.java
@@ -20,6 +20,8 @@ import java.util.Map;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.NoTypeConversionAvailableException;
import org.apache.camel.component.salesforce.SalesforceComponent;
import org.apache.camel.component.salesforce.SalesforceEndpoint;
import org.apache.camel.component.salesforce.api.SalesforceException;
@@ -39,7 +41,7 @@ public abstract class AbstractSalesforceProcessor implements SalesforceProcessor
protected final Logger log = LoggerFactory.getLogger(this.getClass());
protected final SalesforceEndpoint endpoint;
- protected final Map<String, String> endpointConfigMap;
+ protected final Map<String, Object> endpointConfigMap;
protected final OperationName operationName;
protected final SalesforceSession session;
@@ -59,24 +61,65 @@ public abstract class AbstractSalesforceProcessor implements SalesforceProcessor
public abstract boolean process(Exchange exchange, AsyncCallback callback);
/**
- * Gets value for a parameter from header, endpoint config, or exchange body (optional).
+ * Gets String value for a parameter from header, endpoint config, or exchange body (optional).
*
- * @param exchange exchange to inspect
- * @param convertInBody converts In body to String value if true
- * @param propName name of property
- * @param optional if {@code true} returns null, otherwise throws RestException
+ * @param exchange exchange to inspect
+ * @param convertInBody converts In body to String value if true
+ * @param propName name of property
+ * @param optional if {@code true} returns null, otherwise throws RestException
* @return value of property, or {@code null} for optional parameters if not found.
* @throws org.apache.camel.component.salesforce.api.SalesforceException
- * if the property can't be found.
+ * if the property can't be found or on conversion errors.
*/
protected final String getParameter(String propName, Exchange exchange, boolean convertInBody, boolean optional) throws SalesforceException {
- String propValue = exchange.getIn().getHeader(propName, String.class);
- propValue = propValue == null ? endpointConfigMap.get(propName) : propValue;
- propValue = (propValue == null && convertInBody) ? exchange.getIn().getBody(String.class) : propValue;
+ return getParameter(propName, exchange, convertInBody, optional, String.class);
+ }
+
+ /**
+ * Gets value for a parameter from header, endpoint config, or exchange body (optional).
+ *
+ * @param exchange exchange to inspect
+ * @param convertInBody converts In body to parameterClass value if true
+ * @param propName name of property
+ * @param optional if {@code true} returns null, otherwise throws RestException
+ * @param parameterClass parameter type
+ * @return value of property, or {@code null} for optional parameters if not found.
+ * @throws org.apache.camel.component.salesforce.api.SalesforceException
+ * if the property can't be found or on conversion errors.
+ */
+ protected final <T> T getParameter(String propName, Exchange exchange, boolean convertInBody, boolean optional,
+ Class<T> parameterClass) throws SalesforceException {
+
+ final Message in = exchange.getIn();
+ T propValue = in.getHeader(propName, parameterClass);
+
+ if (propValue == null) {
+ // check if type conversion failed
+ if (in.getHeader(propName) != null) {
+ throw new IllegalArgumentException("Header " + propName
+ + " could not be converted to type " + parameterClass.getName());
+ }
+
+ final Object value = endpointConfigMap.get(propName);
+
+ if (value == null || parameterClass.isInstance(value)) {
+ propValue = parameterClass.cast(value);
+ } else {
+
+ try {
+ propValue = exchange.getContext().getTypeConverter().mandatoryConvertTo(parameterClass, value);
+ } catch (NoTypeConversionAvailableException e) {
+ throw new SalesforceException(e);
+ }
+ }
+ }
+
+ propValue = (propValue == null && convertInBody) ? in.getBody(parameterClass) : propValue;
// error if property was not set
if (propValue == null && !optional) {
- String msg = "Missing property " + propName;
+ String msg = "Missing property " + propName
+ + (convertInBody ? ", message body could not be converted to type " + parameterClass.getName() : "");
throw new SalesforceException(msg, null);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AnalyticsApiProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AnalyticsApiProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AnalyticsApiProcessor.java
new file mode 100644
index 0000000..846bd62
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AnalyticsApiProcessor.java
@@ -0,0 +1,227 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.internal.processor;
+
+import java.util.List;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.component.salesforce.SalesforceEndpoint;
+import org.apache.camel.component.salesforce.SalesforceEndpointConfig;
+import org.apache.camel.component.salesforce.api.SalesforceException;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.AbstractReportResultsBase;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.RecentReport;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportDescription;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportInstance;
+import org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportMetadata;
+import org.apache.camel.component.salesforce.internal.client.AnalyticsApiClient;
+import org.apache.camel.component.salesforce.internal.client.DefaultAnalyticsApiClient;
+import org.apache.camel.util.ServiceHelper;
+
+import static org.apache.camel.component.salesforce.SalesforceEndpointConfig.INCLUDE_DETAILS;
+import static org.apache.camel.component.salesforce.SalesforceEndpointConfig.INSTANCE_ID;
+import static org.apache.camel.component.salesforce.SalesforceEndpointConfig.REPORT_ID;
+import static org.apache.camel.component.salesforce.SalesforceEndpointConfig.REPORT_METADATA;
+
+/**
+ * Exchange processor for Analytics API.
+ */
+public class AnalyticsApiProcessor extends AbstractSalesforceProcessor {
+
+ private AnalyticsApiClient analyticsClient;
+
+ public AnalyticsApiProcessor(SalesforceEndpoint endpoint) throws SalesforceException {
+ super(endpoint);
+
+ this.analyticsClient = new DefaultAnalyticsApiClient(
+ (String) endpointConfigMap.get(SalesforceEndpointConfig.API_VERSION), session, httpClient);
+ }
+
+ @Override
+ public boolean process(final Exchange exchange, final AsyncCallback callback) {
+ boolean done = false;
+
+ try {
+ switch (operationName) {
+ case GET_RECENT_REPORTS:
+ processGetRecentReports(exchange, callback);
+ break;
+ case GET_REPORT_DESCRIPTION:
+ processGetReportDescription(exchange, callback);
+ break;
+ case EXECUTE_SYNCREPORT:
+ processExecuteSyncReport(exchange, callback);
+ break;
+ case EXECUTE_ASYNCREPORT:
+ processExecuteAsyncReport(exchange, callback);
+ break;
+ case GET_REPORT_INSTANCES:
+ processGetReportInstances(exchange, callback);
+ break;
+ case GET_REPORT_RESULTS:
+ processGetReportResults(exchange, callback);
+ break;
+ default:
+ throw new SalesforceException("Unknown operation name: " + operationName.value(), null);
+ }
+ } catch (SalesforceException e) {
+ exchange.setException(new SalesforceException(
+ String.format("Error processing %s: [%s] \"%s\"",
+ operationName.value(), e.getStatusCode(), e.getMessage()), e));
+ callback.done(true);
+ done = true;
+ } catch (RuntimeException e) {
+ exchange.setException(new SalesforceException(
+ String.format("Unexpected Error processing %s: \"%s\"",
+ operationName.value(), e.getMessage()), e));
+ callback.done(true);
+ done = true;
+ }
+
+ // continue routing asynchronously if false
+ return done;
+ }
+
+ private void processGetRecentReports(final Exchange exchange, final AsyncCallback callback) {
+
+ analyticsClient.getRecentReports(new AnalyticsApiClient.RecentReportsResponseCallback() {
+ @Override
+ public void onResponse(List<RecentReport> reportDescription, SalesforceException ex) {
+ processResponse(exchange, reportDescription, ex, callback);
+ }
+ });
+ }
+
+ private void processGetReportDescription(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
+
+ final String reportId = getParameter(REPORT_ID, exchange, USE_BODY, NOT_OPTIONAL);
+
+ analyticsClient.getReportDescription(reportId, new AnalyticsApiClient.ReportDescriptionResponseCallback() {
+ @Override
+ public void onResponse(ReportDescription reportDescription, SalesforceException ex) {
+ processResponse(exchange, reportDescription, ex, callback);
+ }
+ });
+ }
+
+ 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);
+ }
+ });
+ }
+
+ private void processExecuteAsyncReport(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.executeAsyncReport(reportId, includeDetails, reportMetadata,
+ new AnalyticsApiClient.ReportInstanceResponseCallback() {
+ @Override
+ public void onResponse(ReportInstance reportInstance, SalesforceException ex) {
+ processResponse(exchange, reportInstance, ex, callback);
+ }
+ });
+ }
+
+ private void processGetReportInstances(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
+
+ final String reportId = getParameter(REPORT_ID, exchange, USE_BODY, NOT_OPTIONAL);
+
+ analyticsClient.getReportInstances(reportId, new AnalyticsApiClient.ReportInstanceListResponseCallback() {
+ @Override
+ public void onResponse(List<ReportInstance> reportInstances, SalesforceException ex) {
+ processResponse(exchange, reportInstances, ex, callback);
+ }
+ });
+ }
+
+ private void processGetReportResults(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
+
+ final String reportId = getParameter(REPORT_ID, exchange, USE_BODY, NOT_OPTIONAL);
+ final String instanceId = getParameter(INSTANCE_ID, exchange, IGNORE_BODY, NOT_OPTIONAL);
+
+ analyticsClient.getReportResults(reportId, instanceId, new AnalyticsApiClient.ReportResultsResponseCallback() {
+ @Override
+ public void onResponse(AbstractReportResultsBase reportResults, SalesforceException ex) {
+ processResponse(exchange, reportResults, ex, callback);
+ }
+ });
+ }
+
+ private void processResponse(Exchange exchange, Object body, SalesforceException ex, AsyncCallback callback) {
+ final Message out = exchange.getOut();
+ if (ex != null) {
+ exchange.setException(ex);
+ } else {
+ out.setBody(body);
+ }
+
+ // copy headers and attachments
+ out.getHeaders().putAll(exchange.getIn().getHeaders());
+ out.getAttachments().putAll(exchange.getIn().getAttachments());
+
+ // signal exchange completion
+ callback.done(false);
+ }
+
+ @Override
+ public void start() throws Exception {
+ ServiceHelper.startService(analyticsClient);
+ }
+
+ @Override
+ public void stop() throws Exception {
+ // stop the client
+ ServiceHelper.stopService(analyticsClient);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/BulkApiProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/BulkApiProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/BulkApiProcessor.java
index 80d382d..f83ad9d 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/BulkApiProcessor.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/BulkApiProcessor.java
@@ -51,7 +51,7 @@ public class BulkApiProcessor extends AbstractSalesforceProcessor {
super(endpoint);
this.bulkClient = new DefaultBulkApiClient(
- endpointConfigMap.get(SalesforceEndpointConfig.API_VERSION), session, httpClient);
+ (String) endpointConfigMap.get(SalesforceEndpointConfig.API_VERSION), session, httpClient);
}
@Override
@@ -97,24 +97,24 @@ public class BulkApiProcessor extends AbstractSalesforceProcessor {
processGetQueryResult(exchange, callback);
break;
default:
- throw new SalesforceException("Unknow operation name: " + operationName, null);
+ throw new SalesforceException("Unknown operation name: " + operationName.value(), null);
}
} catch (SalesforceException e) {
exchange.setException(new SalesforceException(
String.format("Error processing %s: [%s] \"%s\"",
- operationName, e.getStatusCode(), e.getMessage()), e));
+ operationName.value(), e.getStatusCode(), e.getMessage()), e));
callback.done(true);
done = true;
} catch (InvalidPayloadException e) {
exchange.setException(new SalesforceException(
String.format("Unexpected Error processing %s: \"%s\"",
- operationName, e.getMessage()), e));
+ operationName.value(), e.getMessage()), e));
callback.done(true);
done = true;
} catch (RuntimeException e) {
exchange.setException(new SalesforceException(
String.format("Unexpected Error processing %s: \"%s\"",
- operationName, e.getMessage()), e));
+ operationName.value(), e.getMessage()), e));
callback.done(true);
done = true;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/7e3b3510/components/camel-salesforce/camel-salesforce-component/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel-salesforce/camel-salesforce-component/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
new file mode 100644
index 0000000..4488642
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.camel.component.salesforce.api.SalesforceReportResultsToListConverter