You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/11/19 03:57:14 UTC

[GitHub] [camel] jeremyross opened a new pull request #4630: CAMEL-15866: salesforce: Support new SOSL search result

jeremyross opened a new pull request #4630:
URL: https://github.com/apache/camel/pull/4630


   CAMEL-15866: salesforce: Support new SOSL search result


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] omarsmak commented on a change in pull request #4630: CAMEL-15866: salesforce: Support new SOSL search result

Posted by GitBox <gi...@apache.org>.
omarsmak commented on a change in pull request #4630:
URL: https://github.com/apache/camel/pull/4630#discussion_r526985194



##########
File path: components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java
##########
@@ -100,7 +101,11 @@ protected void processRequest(Exchange exchange) throws SalesforceException {
 
             case SEARCH:
                 // handle known response type
-                exchange.setProperty(RESPONSE_TYPE, TypeReferences.SEARCH_RESULT_TYPE);
+                if (Double.parseDouble(endpoint.getConfiguration().getApiVersion()) >= 37.0) {

Review comment:
       can we somewhat move the version `37.0` number into a constant?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] oscerd commented on a change in pull request #4630: CAMEL-15866: salesforce: Support new SOSL search result

Posted by GitBox <gi...@apache.org>.
oscerd commented on a change in pull request #4630:
URL: https://github.com/apache/camel/pull/4630#discussion_r526608089



##########
File path: components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/SearchResult2.java
##########
@@ -0,0 +1,27 @@
+package org.apache.camel.component.salesforce.api.dto;

Review comment:
       Please add license




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus merged pull request #4630: CAMEL-15866: salesforce: Support new SOSL search result

Posted by GitBox <gi...@apache.org>.
davsclaus merged pull request #4630:
URL: https://github.com/apache/camel/pull/4630


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] jeremyross commented on a change in pull request #4630: CAMEL-15866: salesforce: Support new SOSL search result

Posted by GitBox <gi...@apache.org>.
jeremyross commented on a change in pull request #4630:
URL: https://github.com/apache/camel/pull/4630#discussion_r527040265



##########
File path: components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java
##########
@@ -100,7 +101,11 @@ protected void processRequest(Exchange exchange) throws SalesforceException {
 
             case SEARCH:
                 // handle known response type
-                exchange.setProperty(RESPONSE_TYPE, TypeReferences.SEARCH_RESULT_TYPE);
+                if (Double.parseDouble(endpoint.getConfiguration().getApiVersion()) >= 37.0) {

Review comment:
       I know, it bothers me too. But I think `public static final String API_VERSION_37_0 = "37.0";` would bother me more. It brings nothing to the party, ya know?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] jeremyross commented on a change in pull request #4630: CAMEL-15866: salesforce: Support new SOSL search result

Posted by GitBox <gi...@apache.org>.
jeremyross commented on a change in pull request #4630:
URL: https://github.com/apache/camel/pull/4630#discussion_r526994282



##########
File path: components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java
##########
@@ -100,7 +101,11 @@ protected void processRequest(Exchange exchange) throws SalesforceException {
 
             case SEARCH:
                 // handle known response type
-                exchange.setProperty(RESPONSE_TYPE, TypeReferences.SEARCH_RESULT_TYPE);
+                if (Double.parseDouble(endpoint.getConfiguration().getApiVersion()) >= 37.0) {

Review comment:
       I considered that, but couldn't think of a good name. There's no concept that symbolizes any given version. Open to suggestions.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] jeremyross commented on a change in pull request #4630: CAMEL-15866: salesforce: Support new SOSL search result

Posted by GitBox <gi...@apache.org>.
jeremyross commented on a change in pull request #4630:
URL: https://github.com/apache/camel/pull/4630#discussion_r527036293



##########
File path: components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java
##########
@@ -100,7 +101,11 @@ protected void processRequest(Exchange exchange) throws SalesforceException {
 
             case SEARCH:
                 // handle known response type
-                exchange.setProperty(RESPONSE_TYPE, TypeReferences.SEARCH_RESULT_TYPE);
+                if (Double.parseDouble(endpoint.getConfiguration().getApiVersion()) >= 37.0) {

Review comment:
       But I'm glad you asked this, because I now realize that JsonRestProcessor should be using RESPONSE_CLASS for SearchResult2. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] omarsmak commented on a change in pull request #4630: CAMEL-15866: salesforce: Support new SOSL search result

Posted by GitBox <gi...@apache.org>.
omarsmak commented on a change in pull request #4630:
URL: https://github.com/apache/camel/pull/4630#discussion_r527041949



##########
File path: components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java
##########
@@ -100,7 +101,11 @@ protected void processRequest(Exchange exchange) throws SalesforceException {
 
             case SEARCH:
                 // handle known response type
-                exchange.setProperty(RESPONSE_TYPE, TypeReferences.SEARCH_RESULT_TYPE);
+                if (Double.parseDouble(endpoint.getConfiguration().getApiVersion()) >= 37.0) {

Review comment:
       yeah I know, is fine then 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] omarsmak commented on a change in pull request #4630: CAMEL-15866: salesforce: Support new SOSL search result

Posted by GitBox <gi...@apache.org>.
omarsmak commented on a change in pull request #4630:
URL: https://github.com/apache/camel/pull/4630#discussion_r527009458



##########
File path: components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java
##########
@@ -100,7 +101,11 @@ protected void processRequest(Exchange exchange) throws SalesforceException {
 
             case SEARCH:
                 // handle known response type
-                exchange.setProperty(RESPONSE_TYPE, TypeReferences.SEARCH_RESULT_TYPE);
+                if (Double.parseDouble(endpoint.getConfiguration().getApiVersion()) >= 37.0) {

Review comment:
       True, another option is, we can create a common function in the `AbstractRestProcessor` that sets response type property for `Json` and `XML`, e.g:
   ```
   protected void setSearchResponseType(Object fallbackType) {
   if (Double.parseDouble(endpoint.getConfiguration().getApiVersion()) >= 37.0) {
          exchange.setProperty(RESPONSE_TYPE, SearchResult2.class);
   } else {
          exchange.setProperty(RESPONSE_TYPE, fallbackType);
        }
   }
   ```
   
   And then called either `setSearchResponseType(TypeReferences.SEARCH_RESULT_TYPE)` or `setSearchResponseType(SearchResults.class)`. WDYT?
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] omarsmak commented on a change in pull request #4630: CAMEL-15866: salesforce: Support new SOSL search result

Posted by GitBox <gi...@apache.org>.
omarsmak commented on a change in pull request #4630:
URL: https://github.com/apache/camel/pull/4630#discussion_r527037242



##########
File path: components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java
##########
@@ -100,7 +101,11 @@ protected void processRequest(Exchange exchange) throws SalesforceException {
 
             case SEARCH:
                 // handle known response type
-                exchange.setProperty(RESPONSE_TYPE, TypeReferences.SEARCH_RESULT_TYPE);
+                if (Double.parseDouble(endpoint.getConfiguration().getApiVersion()) >= 37.0) {

Review comment:
       ah sorry didn't realize that, you are right, only the version need to be extracted. Anyway, if you can't find a some meaningful naming, is also fine like this as long not much of duplications happening, just wanted to avoid the magic number ;)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] jeremyross commented on a change in pull request #4630: CAMEL-15866: salesforce: Support new SOSL search result

Posted by GitBox <gi...@apache.org>.
jeremyross commented on a change in pull request #4630:
URL: https://github.com/apache/camel/pull/4630#discussion_r527028161



##########
File path: components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java
##########
@@ -100,7 +101,11 @@ protected void processRequest(Exchange exchange) throws SalesforceException {
 
             case SEARCH:
                 // handle known response type
-                exchange.setProperty(RESPONSE_TYPE, TypeReferences.SEARCH_RESULT_TYPE);
+                if (Double.parseDouble(endpoint.getConfiguration().getApiVersion()) >= 37.0) {

Review comment:
       Hmm. JsonRestProcessor sets the RESPONSE_TYPE property, whereas XmlRestProcessor sets the RESPONSE_CLASS property. And for  < 37.0, the type is different. I'm struggling to find enough in common to extract.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org