You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2023/03/30 06:14:49 UTC

[camel] 01/04: CAMEL-19222 - Camel-Azure-CosmosDB: make the itemPartitionKey a String instead of a pojo

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b3a566b0647a12658cf61caea1138649f61d39fb
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Mar 30 08:01:18 2023 +0200

    CAMEL-19222 - Camel-Azure-CosmosDB: make the itemPartitionKey a String instead of a pojo
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../camel/component/azure/cosmosdb/CosmosDbComponentConfigurer.java | 4 ++--
 .../camel/component/azure/cosmosdb/CosmosDbEndpointConfigurer.java  | 4 ++--
 .../org/apache/camel/component/azure/cosmosdb/azure-cosmosdb.json   | 4 ++--
 .../camel/component/azure/cosmosdb/CosmosDbConfiguration.java       | 6 +++---
 .../component/azure/cosmosdb/CosmosDbConfigurationOptionsProxy.java | 4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/components/camel-azure/camel-azure-cosmosdb/src/generated/java/org/apache/camel/component/azure/cosmosdb/CosmosDbComponentConfigurer.java b/components/camel-azure/camel-azure-cosmosdb/src/generated/java/org/apache/camel/component/azure/cosmosdb/CosmosDbComponentConfigurer.java
index 039a76b5652..b6c6af2d252 100644
--- a/components/camel-azure/camel-azure-cosmosdb/src/generated/java/org/apache/camel/component/azure/cosmosdb/CosmosDbComponentConfigurer.java
+++ b/components/camel-azure/camel-azure-cosmosdb/src/generated/java/org/apache/camel/component/azure/cosmosdb/CosmosDbComponentConfigurer.java
@@ -64,7 +64,7 @@ public class CosmosDbComponentConfigurer extends PropertyConfigurerSupport imple
         case "itemid":
         case "itemId": getOrCreateConfiguration(target).setItemId(property(camelContext, java.lang.String.class, value)); return true;
         case "itempartitionkey":
-        case "itemPartitionKey": getOrCreateConfiguration(target).setItemPartitionKey(property(camelContext, com.azure.cosmos.models.PartitionKey.class, value)); return true;
+        case "itemPartitionKey": getOrCreateConfiguration(target).setItemPartitionKey(property(camelContext, java.lang.String.class, value)); return true;
         case "lazystartproducer":
         case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
         case "leasecontainername":
@@ -131,7 +131,7 @@ public class CosmosDbComponentConfigurer extends PropertyConfigurerSupport imple
         case "itemid":
         case "itemId": return java.lang.String.class;
         case "itempartitionkey":
-        case "itemPartitionKey": return com.azure.cosmos.models.PartitionKey.class;
+        case "itemPartitionKey": return java.lang.String.class;
         case "lazystartproducer":
         case "lazyStartProducer": return boolean.class;
         case "leasecontainername":
diff --git a/components/camel-azure/camel-azure-cosmosdb/src/generated/java/org/apache/camel/component/azure/cosmosdb/CosmosDbEndpointConfigurer.java b/components/camel-azure/camel-azure-cosmosdb/src/generated/java/org/apache/camel/component/azure/cosmosdb/CosmosDbEndpointConfigurer.java
index ea0af3bb7f0..69f9ca021c6 100644
--- a/components/camel-azure/camel-azure-cosmosdb/src/generated/java/org/apache/camel/component/azure/cosmosdb/CosmosDbEndpointConfigurer.java
+++ b/components/camel-azure/camel-azure-cosmosdb/src/generated/java/org/apache/camel/component/azure/cosmosdb/CosmosDbEndpointConfigurer.java
@@ -58,7 +58,7 @@ public class CosmosDbEndpointConfigurer extends PropertyConfigurerSupport implem
         case "itemid":
         case "itemId": target.getConfiguration().setItemId(property(camelContext, java.lang.String.class, value)); return true;
         case "itempartitionkey":
-        case "itemPartitionKey": target.getConfiguration().setItemPartitionKey(property(camelContext, com.azure.cosmos.models.PartitionKey.class, value)); return true;
+        case "itemPartitionKey": target.getConfiguration().setItemPartitionKey(property(camelContext, java.lang.String.class, value)); return true;
         case "lazystartproducer":
         case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
         case "leasecontainername":
@@ -126,7 +126,7 @@ public class CosmosDbEndpointConfigurer extends PropertyConfigurerSupport implem
         case "itemid":
         case "itemId": return java.lang.String.class;
         case "itempartitionkey":
-        case "itemPartitionKey": return com.azure.cosmos.models.PartitionKey.class;
+        case "itemPartitionKey": return java.lang.String.class;
         case "lazystartproducer":
         case "lazyStartProducer": return boolean.class;
         case "leasecontainername":
diff --git a/components/camel-azure/camel-azure-cosmosdb/src/generated/resources/org/apache/camel/component/azure/cosmosdb/azure-cosmosdb.json b/components/camel-azure/camel-azure-cosmosdb/src/generated/resources/org/apache/camel/component/azure/cosmosdb/azure-cosmosdb.json
index fab4ba1d705..b74358b0755 100644
--- a/components/camel-azure/camel-azure-cosmosdb/src/generated/resources/org/apache/camel/component/azure/cosmosdb/azure-cosmosdb.json
+++ b/components/camel-azure/camel-azure-cosmosdb/src/generated/resources/org/apache/camel/component/azure/cosmosdb/azure-cosmosdb.json
@@ -44,7 +44,7 @@
     "leaseContainerName": { "kind": "property", "displayName": "Lease Container Name", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "camel-lease", "configurationClass": "org.apache.camel.component.azure.cosmosdb.CosmosDbConfiguration", "configurationField": "configuration", "description": "Sets the lease container which acts as a state storage and co [...]
     "leaseDatabaseName": { "kind": "property", "displayName": "Lease Database Name", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.cosmosdb.CosmosDbConfiguration", "configurationField": "configuration", "description": "Sets the lease database where the leaseContainerName will be stored. If it is not specified, t [...]
     "itemId": { "kind": "property", "displayName": "Item Id", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.cosmosdb.CosmosDbConfiguration", "configurationField": "configuration", "description": "Sets the itemId in case needed for operation on item like delete, replace" },
-    "itemPartitionKey": { "kind": "property", "displayName": "Item Partition Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.cosmos.models.PartitionKey", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.cosmosdb.CosmosDbConfiguration", "configurationField": "configuration", "description": "Sets partition key. Represents a partition key value in the Azure Cosmos DB  [...]
+    "itemPartitionKey": { "kind": "property", "displayName": "Item Partition Key", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.cosmosdb.CosmosDbConfiguration", "configurationField": "configuration", "description": "Sets partition key. Represents a partition key value in the Azure Cosmos DB database service. A  [...]
     "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...]
     "operation": { "kind": "property", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.cosmosdb.CosmosDbOperationsDefinition", "enum": [ "listDatabases", "createDatabase", "queryDatabases", "deleteDatabase", "createContainer", "replaceDatabaseThroughput", "listContainers", "queryContainers", "deleteContainer", "replaceContainerThroughput", "createItem", "upsertItem", "deleteItem", "re [...]
     "query": { "kind": "property", "displayName": "Query", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.cosmosdb.CosmosDbConfiguration", "configurationField": "configuration", "description": "An SQL query to execute on a given resources. To learn more about Cosmos SQL API, check this link {link https:\/\/docs.m [...]
@@ -78,7 +78,7 @@
     "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the con [...]
     "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
     "itemId": { "kind": "parameter", "displayName": "Item Id", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.cosmosdb.CosmosDbConfiguration", "configurationField": "configuration", "description": "Sets the itemId in case needed for operation on item like delete, replace" },
-    "itemPartitionKey": { "kind": "parameter", "displayName": "Item Partition Key", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.cosmos.models.PartitionKey", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.cosmosdb.CosmosDbConfiguration", "configurationField": "configuration", "description": "Sets partition key. Represents a partition key value in the Azure Cosmos DB [...]
+    "itemPartitionKey": { "kind": "parameter", "displayName": "Item Partition Key", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.cosmosdb.CosmosDbConfiguration", "configurationField": "configuration", "description": "Sets partition key. Represents a partition key value in the Azure Cosmos DB database service. A [...]
     "operation": { "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.cosmosdb.CosmosDbOperationsDefinition", "enum": [ "listDatabases", "createDatabase", "queryDatabases", "deleteDatabase", "createContainer", "replaceDatabaseThroughput", "listContainers", "queryContainers", "deleteContainer", "replaceContainerThroughput", "createItem", "upsertItem", "deleteItem", "r [...]
     "query": { "kind": "parameter", "displayName": "Query", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.cosmosdb.CosmosDbConfiguration", "configurationField": "configuration", "description": "An SQL query to execute on a given resources. To learn more about Cosmos SQL API, check this link {link https:\/\/docs. [...]
     "queryRequestOptions": { "kind": "parameter", "displayName": "Query Request Options", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.cosmos.models.CosmosQueryRequestOptions", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.cosmosdb.CosmosDbConfiguration", "configurationField": "configuration", "description": "Set additional QueryRequestOptions that can be used with [...]
diff --git a/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbConfiguration.java b/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbConfiguration.java
index b507fcd6728..ee0ef3bca38 100644
--- a/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbConfiguration.java
+++ b/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbConfiguration.java
@@ -81,7 +81,7 @@ public class CosmosDbConfiguration implements Cloneable {
     @UriParam(label = "producer")
     private String query;
     @UriParam(label = "producer")
-    private PartitionKey itemPartitionKey;
+    private String itemPartitionKey;
     @UriParam(label = "producer")
     private String itemId;
     @UriParam(label = "producer")
@@ -153,11 +153,11 @@ public class CosmosDbConfiguration implements Cloneable {
      * Sets partition key. Represents a partition key value in the Azure Cosmos DB database service. A partition key
      * identifies the partition where the item is stored in.
      */
-    public PartitionKey getItemPartitionKey() {
+    public String getItemPartitionKey() {
         return itemPartitionKey;
     }
 
-    public void setItemPartitionKey(PartitionKey itemPartitionKey) {
+    public void setItemPartitionKey(String itemPartitionKey) {
         this.itemPartitionKey = itemPartitionKey;
     }
 
diff --git a/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbConfigurationOptionsProxy.java b/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbConfigurationOptionsProxy.java
index f8f5879e90d..680e5c78eb7 100644
--- a/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbConfigurationOptionsProxy.java
+++ b/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/CosmosDbConfigurationOptionsProxy.java
@@ -94,8 +94,8 @@ public class CosmosDbConfigurationOptionsProxy {
     }
 
     public PartitionKey getItemPartitionKey(final Exchange exchange) {
-        return getOption(exchange, CosmosDbConstants.ITEM_PARTITION_KEY, configuration::getItemPartitionKey,
-                PartitionKey.class);
+        return new PartitionKey(getOption(exchange, CosmosDbConstants.ITEM_PARTITION_KEY, configuration::getItemPartitionKey,
+                String.class));
     }
 
     public Object getItem(final Exchange exchange) {