This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch var-headers in repository https://gitbox.apache.org/repos/asf/camel.git
commit a3b2064dd40895aebe43737cf5a39f8e2a30acf4 Author: Claus Ibsen <[email protected]> AuthorDate: Tue Jan 30 06:37:09 2024 +0100 CAMEL-19749: variables - Should also copy message headers into variable when using EIP variables --- .../apache/camel/catalog/languages/hl7terser.json | 9 ++++---- .../org/apache/camel/catalog/languages/jq.json | 9 ++++---- .../apache/camel/catalog/languages/jsonpath.json | 9 ++++---- .../org/apache/camel/catalog/models/hl7terser.json | 9 ++++---- .../org/apache/camel/catalog/models/jq.json | 9 ++++---- .../org/apache/camel/catalog/models/jsonpath.json | 9 ++++---- .../apache/camel/catalog/schemas/camel-spring.xsd | 9 ++++++++ .../org/apache/camel/component/hl7/hl7terser.json | 9 ++++---- .../resources/org/apache/camel/language/jq/jq.json | 9 ++++---- .../org/apache/camel/language/jq/JqExpression.java | 24 +++++++++++++++++-- .../org/apache/camel/language/jq/JqLanguage.java | 2 ++ .../org/apache/camel/jsonpath/jsonpath.json | 9 ++++---- .../apache/camel/jsonpath/JsonPathExpression.java | 12 ++++++++++ .../apache/camel/jsonpath/JsonPathLanguage.java | 8 ++++++- .../camel/language/tokenizer/TokenizeLanguage.java | 2 +- .../org/apache/camel/model/language/hl7terser.json | 9 ++++---- .../org/apache/camel/model/language/jq.json | 9 ++++---- .../org/apache/camel/model/language/jsonpath.json | 9 ++++---- .../SingleInputTypedExpressionDefinition.java | 27 ++++++++++++++++++++++ .../language/JsonPathExpressionReifier.java | 3 ++- .../SingleInputTypedExpressionReifier.java | 3 ++- .../org/apache/camel/support/AbstractExchange.java | 6 ++--- .../camel/support/ExchangeVariableRepository.java | 19 +++++++++++++++ .../camel/support/SingleInputLanguageSupport.java | 18 +++++++++------ .../support/SingleInputTypedLanguageSupport.java | 27 ++++++++++++++-------- .../camel/support/builder/ExpressionBuilder.java | 11 +++++---- .../java/org/apache/camel/xml/in/ModelParser.java | 1 + .../java/org/apache/camel/xml/out/ModelWriter.java | 1 + .../org/apache/camel/yaml/out/ModelWriter.java | 1 + .../dsl/yaml/deserializers/ModelDeserializers.java | 22 ++++++++++++++++-- .../generated/resources/schema/camelYamlDsl.json | 15 ++++++++++++ 31 files changed, 239 insertions(+), 80 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/hl7terser.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/hl7terser.json index 3865481202b..58cd42e820c 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/hl7terser.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/hl7terser.json @@ -18,9 +18,10 @@ "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "expression": { "index": 1, "kind": "value", "displayName": "Expression", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The expression value in your chosen language syntax" }, - "headerName": { "index": 2, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 3, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "resultType": { "index": 4, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "trim": { "index": 5, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "variableName": { "index": 2, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, + "headerName": { "index": 3, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 4, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType": { "index": 5, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 6, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/jq.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/jq.json index 01859b055b7..2414f6e84ef 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/jq.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/jq.json @@ -18,9 +18,10 @@ "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "expression": { "index": 1, "kind": "value", "displayName": "Expression", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The expression value in your chosen language syntax" }, - "headerName": { "index": 2, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 3, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "resultType": { "index": 4, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "trim": { "index": 5, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "variableName": { "index": 2, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, + "headerName": { "index": 3, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 4, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType": { "index": 5, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 6, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/jsonpath.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/jsonpath.json index 1f60d86297e..ec518053441 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/jsonpath.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/jsonpath.json @@ -24,9 +24,10 @@ "writeAsString": { "index": 5, "kind": "attribute", "displayName": "Write As String", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to write the output of each row\/element as a JSON String value instead of a Map\/POJO value." }, "unpackArray": { "index": 6, "kind": "attribute", "displayName": "Unpack Array", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to unpack a single element json-array into an object." }, "option": { "index": 7, "kind": "attribute", "displayName": "Option", "label": "advanced", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "DEFAULT_PATH_LEAF_TO_NULL", "ALWAYS_RETURN_LIST", "AS_PATH_LIST", "SUPPRESS_EXCEPTIONS", "REQUIRE_PROPERTIES" ], "deprecated": false, "autowired": false, "secret": false, "description": "To configure additional options on JSONPath. Multiple values can be separated by comma." }, - "headerName": { "index": 8, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 9, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "resultType": { "index": 10, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "trim": { "index": 11, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "variableName": { "index": 8, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, + "headerName": { "index": 9, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 10, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType": { "index": 11, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 12, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/hl7terser.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/hl7terser.json index c21ace421f3..175a11f5b72 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/hl7terser.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/hl7terser.json @@ -15,9 +15,10 @@ "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "expression": { "index": 1, "kind": "value", "displayName": "Expression", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The expression value in your chosen language syntax" }, - "headerName": { "index": 2, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 3, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "resultType": { "index": 4, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "trim": { "index": 5, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "variableName": { "index": 2, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, + "headerName": { "index": 3, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 4, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType": { "index": 5, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 6, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/jq.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/jq.json index c0d966613c3..04fb7ca5648 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/jq.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/jq.json @@ -15,9 +15,10 @@ "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "expression": { "index": 1, "kind": "value", "displayName": "Expression", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The expression value in your chosen language syntax" }, - "headerName": { "index": 2, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 3, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "resultType": { "index": 4, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "trim": { "index": 5, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "variableName": { "index": 2, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, + "headerName": { "index": 3, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 4, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType": { "index": 5, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 6, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/jsonpath.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/jsonpath.json index 18ebc270c0c..7a139068350 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/jsonpath.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/jsonpath.json @@ -21,9 +21,10 @@ "writeAsString": { "index": 5, "kind": "attribute", "displayName": "Write As String", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to write the output of each row\/element as a JSON String value instead of a Map\/POJO value." }, "unpackArray": { "index": 6, "kind": "attribute", "displayName": "Unpack Array", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to unpack a single element json-array into an object." }, "option": { "index": 7, "kind": "attribute", "displayName": "Option", "label": "advanced", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "DEFAULT_PATH_LEAF_TO_NULL", "ALWAYS_RETURN_LIST", "AS_PATH_LIST", "SUPPRESS_EXCEPTIONS", "REQUIRE_PROPERTIES" ], "deprecated": false, "autowired": false, "secret": false, "description": "To configure additional options on JSONPath. Multiple values can be separated by comma." }, - "headerName": { "index": 8, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 9, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "resultType": { "index": 10, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "trim": { "index": 11, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "variableName": { "index": 8, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, + "headerName": { "index": 9, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 10, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType": { "index": 11, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 12, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd index a9f51331f7f..8db2e5a49fb 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd @@ -15242,6 +15242,15 @@ The String representation of the MediaType to output. <xs:complexType abstract="true" name="singleInputTypedExpressionDefinition"> <xs:simpleContent> <xs:extension base="tns:typedExpressionDefinition"> + <xs:attribute name="variableName" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"> +<![CDATA[ +Name of variable to use as input, instead of the message body It has as higher precedent if other are set. +]]> + </xs:documentation> + </xs:annotation> + </xs:attribute> <xs:attribute name="headerName" type="xs:string"> <xs:annotation> <xs:documentation xml:lang="en"> diff --git a/components/camel-hl7/src/generated/resources/org/apache/camel/component/hl7/hl7terser.json b/components/camel-hl7/src/generated/resources/org/apache/camel/component/hl7/hl7terser.json index 3865481202b..58cd42e820c 100644 --- a/components/camel-hl7/src/generated/resources/org/apache/camel/component/hl7/hl7terser.json +++ b/components/camel-hl7/src/generated/resources/org/apache/camel/component/hl7/hl7terser.json @@ -18,9 +18,10 @@ "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "expression": { "index": 1, "kind": "value", "displayName": "Expression", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The expression value in your chosen language syntax" }, - "headerName": { "index": 2, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 3, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "resultType": { "index": 4, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "trim": { "index": 5, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "variableName": { "index": 2, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, + "headerName": { "index": 3, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 4, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType": { "index": 5, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 6, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/components/camel-jq/src/generated/resources/org/apache/camel/language/jq/jq.json b/components/camel-jq/src/generated/resources/org/apache/camel/language/jq/jq.json index 01859b055b7..2414f6e84ef 100644 --- a/components/camel-jq/src/generated/resources/org/apache/camel/language/jq/jq.json +++ b/components/camel-jq/src/generated/resources/org/apache/camel/language/jq/jq.json @@ -18,9 +18,10 @@ "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "expression": { "index": 1, "kind": "value", "displayName": "Expression", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The expression value in your chosen language syntax" }, - "headerName": { "index": 2, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 3, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "resultType": { "index": 4, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "trim": { "index": 5, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "variableName": { "index": 2, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, + "headerName": { "index": 3, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 4, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType": { "index": 5, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 6, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/components/camel-jq/src/main/java/org/apache/camel/language/jq/JqExpression.java b/components/camel-jq/src/main/java/org/apache/camel/language/jq/JqExpression.java index f66c0f8f1ed..a72cc5f90a3 100644 --- a/components/camel-jq/src/main/java/org/apache/camel/language/jq/JqExpression.java +++ b/components/camel-jq/src/main/java/org/apache/camel/language/jq/JqExpression.java @@ -32,9 +32,11 @@ import org.apache.camel.Exchange; import org.apache.camel.ExpressionIllegalSyntaxException; import org.apache.camel.InvalidPayloadException; import org.apache.camel.NoSuchHeaderOrPropertyException; +import org.apache.camel.NoSuchVariableException; import org.apache.camel.RuntimeCamelException; import org.apache.camel.TypeConverter; import org.apache.camel.spi.ExpressionResultTypeAware; +import org.apache.camel.support.ExchangeHelper; import org.apache.camel.support.ExpressionAdapter; import org.apache.camel.support.MessageHelper; @@ -48,6 +50,7 @@ public class JqExpression extends ExpressionAdapter implements ExpressionResultT private JsonQuery query; private TypeConverter typeConverter; + private String variableName; private String headerName; private String propertyName; @@ -117,6 +120,17 @@ public class JqExpression extends ExpressionAdapter implements ExpressionResultT this.resultTypeName = resultTypeName; } + public String getVariableName() { + return variableName; + } + + /** + * Name of the variable to use as input instead of the message body. + */ + public void setVariableName(String variableName) { + this.variableName = variableName; + } + public String getHeaderName() { return headerName; } @@ -206,7 +220,7 @@ public class JqExpression extends ExpressionAdapter implements ExpressionResultT private JsonNode getPayload(Exchange exchange) throws Exception { JsonNode payload = null; - if (headerName == null && propertyName == null) { + if (variableName == null && headerName == null && propertyName == null) { payload = exchange.getMessage().getBody(JsonNode.class); if (payload == null) { throw new InvalidPayloadException(exchange, JsonNode.class); @@ -214,7 +228,13 @@ public class JqExpression extends ExpressionAdapter implements ExpressionResultT // if body is stream cached then reset, so we can re-read it again MessageHelper.resetStreamCache(exchange.getMessage()); } else { - if (headerName != null) { + if (variableName != null) { + payload = ExchangeHelper.getVariable(exchange, variableName, JsonNode.class); + if (payload == null) { + throw new NoSuchVariableException(exchange, variableName, JsonNode.class); + } + } + if (payload == null && headerName != null) { payload = exchange.getMessage().getHeader(headerName, JsonNode.class); } if (payload == null && propertyName != null) { diff --git a/components/camel-jq/src/main/java/org/apache/camel/language/jq/JqLanguage.java b/components/camel-jq/src/main/java/org/apache/camel/language/jq/JqLanguage.java index c5ef627cf27..91ff60c32d5 100644 --- a/components/camel-jq/src/main/java/org/apache/camel/language/jq/JqLanguage.java +++ b/components/camel-jq/src/main/java/org/apache/camel/language/jq/JqLanguage.java @@ -71,6 +71,7 @@ public class JqLanguage extends SingleInputTypedLanguageSupport implements Stati public Expression createExpression(String expression) { JqExpression answer = new JqExpression(Scope.newChildScope(rootScope), expression); answer.setResultType(getResultType()); + answer.setVariableName(getVariableName()); answer.setHeaderName(getHeaderName()); answer.setPropertyName(getPropertyName()); answer.init(getCamelContext()); @@ -83,6 +84,7 @@ public class JqLanguage extends SingleInputTypedLanguageSupport implements Stati answer.setResultType(property(Class.class, properties, 0, getResultType())); answer.setHeaderName(property(String.class, properties, 1, getHeaderName())); answer.setPropertyName(property(String.class, properties, 2, getPropertyName())); + answer.setVariableName(property(String.class, properties, 3, getVariableName())); answer.init(getCamelContext()); return answer; } diff --git a/components/camel-jsonpath/src/generated/resources/org/apache/camel/jsonpath/jsonpath.json b/components/camel-jsonpath/src/generated/resources/org/apache/camel/jsonpath/jsonpath.json index 1f60d86297e..ec518053441 100644 --- a/components/camel-jsonpath/src/generated/resources/org/apache/camel/jsonpath/jsonpath.json +++ b/components/camel-jsonpath/src/generated/resources/org/apache/camel/jsonpath/jsonpath.json @@ -24,9 +24,10 @@ "writeAsString": { "index": 5, "kind": "attribute", "displayName": "Write As String", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to write the output of each row\/element as a JSON String value instead of a Map\/POJO value." }, "unpackArray": { "index": 6, "kind": "attribute", "displayName": "Unpack Array", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to unpack a single element json-array into an object." }, "option": { "index": 7, "kind": "attribute", "displayName": "Option", "label": "advanced", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "DEFAULT_PATH_LEAF_TO_NULL", "ALWAYS_RETURN_LIST", "AS_PATH_LIST", "SUPPRESS_EXCEPTIONS", "REQUIRE_PROPERTIES" ], "deprecated": false, "autowired": false, "secret": false, "description": "To configure additional options on JSONPath. Multiple values can be separated by comma." }, - "headerName": { "index": 8, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 9, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "resultType": { "index": 10, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "trim": { "index": 11, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "variableName": { "index": 8, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, + "headerName": { "index": 9, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 10, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType": { "index": 11, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 12, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathExpression.java b/components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathExpression.java index 1c8b9cccc29..f0c27d7cd4a 100644 --- a/components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathExpression.java +++ b/components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathExpression.java @@ -43,6 +43,7 @@ public class JsonPathExpression extends ExpressionAdapter { private boolean allowEasyPredicate = true; private boolean writeAsString; private boolean unpackArray; + private String variableName; private String headerName; private String propertyName; private Option[] options; @@ -129,6 +130,17 @@ public class JsonPathExpression extends ExpressionAdapter { this.unpackArray = unpackArray; } + public String getVariableName() { + return variableName; + } + + /** + * Name of variable to use as input, instead of the message body + */ + public void setVariableName(String variableName) { + this.variableName = variableName; + } + public String getHeaderName() { return headerName; } diff --git a/components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathLanguage.java b/components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathLanguage.java index 1dc16711993..b8879cfcbec 100644 --- a/components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathLanguage.java +++ b/components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathLanguage.java @@ -102,9 +102,10 @@ public class JsonPathLanguage extends SingleInputTypedLanguageSupport implements answer.setSuppressExceptions(suppressExceptions); answer.setAllowSimple(allowSimple); answer.setAllowEasyPredicate(allowEasyPredicate); - answer.setHeaderName(getHeaderName()); answer.setWriteAsString(writeAsString); answer.setUnpackArray(unpackArray); + answer.setVariableName(getVariableName()); + answer.setHeaderName(getHeaderName()); answer.setPropertyName(getPropertyName()); answer.setOptions(options); answer.init(getCamelContext()); @@ -137,6 +138,7 @@ public class JsonPathLanguage extends SingleInputTypedLanguageSupport implements answer.setOptions(list.toArray(new Option[0])); } answer.setPropertyName(property(String.class, properties, 8, getPropertyName())); + answer.setVariableName(property(String.class, properties, 9, getVariableName())); answer.init(getCamelContext()); return answer; } @@ -178,6 +180,10 @@ public class JsonPathLanguage extends SingleInputTypedLanguageSupport implements case "allowEasyPredicate": setAllowEasyPredicate(PropertyConfigurerSupport.property(camelContext, boolean.class, value)); return true; + case "variablename": + case "variableName": + setVariableName(PropertyConfigurerSupport.property(camelContext, String.class, value)); + return true; case "headername": case "headerName": setHeaderName(PropertyConfigurerSupport.property(camelContext, String.class, value)); diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java index 0d9b0da25f8..62b63391ba1 100644 --- a/core/camel-core-languages/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java +++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java @@ -133,7 +133,7 @@ public class TokenizeLanguage extends SingleInputLanguageSupport implements Prop if (answer == null) { // use the regular tokenizer - final Expression exp = ExpressionBuilder.singleInputExpression(getHeaderName(), getPropertyName()); + final Expression exp = ExpressionBuilder.singleInputExpression(getVariableName(), getHeaderName(), getPropertyName()); if (regex) { answer = ExpressionBuilder.regexTokenizeExpression(exp, token); } else { diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/hl7terser.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/hl7terser.json index c21ace421f3..175a11f5b72 100644 --- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/hl7terser.json +++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/hl7terser.json @@ -15,9 +15,10 @@ "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "expression": { "index": 1, "kind": "value", "displayName": "Expression", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The expression value in your chosen language syntax" }, - "headerName": { "index": 2, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 3, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "resultType": { "index": 4, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "trim": { "index": 5, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "variableName": { "index": 2, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, + "headerName": { "index": 3, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 4, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType": { "index": 5, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 6, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/jq.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/jq.json index c0d966613c3..04fb7ca5648 100644 --- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/jq.json +++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/jq.json @@ -15,9 +15,10 @@ "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "expression": { "index": 1, "kind": "value", "displayName": "Expression", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The expression value in your chosen language syntax" }, - "headerName": { "index": 2, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 3, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "resultType": { "index": 4, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "trim": { "index": 5, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "variableName": { "index": 2, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, + "headerName": { "index": 3, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 4, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType": { "index": 5, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 6, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/jsonpath.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/jsonpath.json index 18ebc270c0c..7a139068350 100644 --- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/jsonpath.json +++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/jsonpath.json @@ -21,9 +21,10 @@ "writeAsString": { "index": 5, "kind": "attribute", "displayName": "Write As String", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to write the output of each row\/element as a JSON String value instead of a Map\/POJO value." }, "unpackArray": { "index": 6, "kind": "attribute", "displayName": "Unpack Array", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to unpack a single element json-array into an object." }, "option": { "index": 7, "kind": "attribute", "displayName": "Option", "label": "advanced", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "DEFAULT_PATH_LEAF_TO_NULL", "ALWAYS_RETURN_LIST", "AS_PATH_LIST", "SUPPRESS_EXCEPTIONS", "REQUIRE_PROPERTIES" ], "deprecated": false, "autowired": false, "secret": false, "description": "To configure additional options on JSONPath. Multiple values can be separated by comma." }, - "headerName": { "index": 8, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 9, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "resultType": { "index": 10, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "trim": { "index": 11, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "variableName": { "index": 8, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, + "headerName": { "index": 9, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 10, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType": { "index": 11, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 12, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/language/SingleInputTypedExpressionDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/language/SingleInputTypedExpressionDefinition.java index 8f4e30204da..148d26a6e3b 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/language/SingleInputTypedExpressionDefinition.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/language/SingleInputTypedExpressionDefinition.java @@ -27,6 +27,8 @@ import org.apache.camel.spi.Metadata; */ public abstract class SingleInputTypedExpressionDefinition extends TypedExpressionDefinition { + @XmlAttribute + private String variableName; @XmlAttribute @Metadata(label = "advanced") private String headerName; @@ -47,10 +49,24 @@ public abstract class SingleInputTypedExpressionDefinition extends TypedExpressi protected SingleInputTypedExpressionDefinition(AbstractBuilder<?, ?> builder) { super(builder); + this.variableName = builder.variableName; this.headerName = builder.headerName; this.propertyName = builder.propertyName; } + public String getVariableName() { + return variableName; + } + + /** + * Name of variable to use as input, instead of the message body + * </p> + * It has as higher precedent if other are set. + */ + public void setVariableName(String variableName) { + this.variableName = variableName; + } + public String getHeaderName() { return headerName; } @@ -86,9 +102,20 @@ public abstract class SingleInputTypedExpressionDefinition extends TypedExpressi T extends AbstractBuilder<T, E>, E extends SingleInputTypedExpressionDefinition> extends TypedExpressionDefinition.AbstractBuilder<T, E> { + private String variableName; private String headerName; private String propertyName; + /** + * Name of variable to use as input, instead of the message body + * </p> + * It has as higher precedent if other are set. + */ + public T variableName(String variableName) { + this.variableName = variableName; + return (T) this; + } + /** * Name of header to use as input, instead of the message body * </p> diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/JsonPathExpressionReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/JsonPathExpressionReifier.java index 71e3562bb8b..270c7364273 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/JsonPathExpressionReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/JsonPathExpressionReifier.java @@ -28,7 +28,7 @@ public class JsonPathExpressionReifier extends SingleInputTypedExpressionReifier @Override protected Object[] createProperties() { - Object[] properties = new Object[9]; + Object[] properties = new Object[10]; properties[0] = definition.getResultType(); properties[1] = parseBoolean(definition.getSuppressExceptions()); properties[2] = parseBoolean(definition.getAllowSimple()); @@ -38,6 +38,7 @@ public class JsonPathExpressionReifier extends SingleInputTypedExpressionReifier properties[6] = parseString(definition.getHeaderName()); properties[7] = parseString(definition.getOption()); properties[8] = parseString(definition.getPropertyName()); + properties[9] = parseString(definition.getVariableName()); return properties; } diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/SingleInputTypedExpressionReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/SingleInputTypedExpressionReifier.java index 3eab302ec6b..d375320454e 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/SingleInputTypedExpressionReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/SingleInputTypedExpressionReifier.java @@ -35,10 +35,11 @@ class SingleInputTypedExpressionReifier<T extends SingleInputTypedExpressionDefi @Override protected Object[] createProperties() { - Object[] properties = new Object[3]; + Object[] properties = new Object[4]; properties[0] = definition.getResultType(); properties[1] = parseString(definition.getHeaderName()); properties[2] = parseString(definition.getPropertyName()); + properties[3] = parseString(definition.getVariableName()); return properties; } } diff --git a/core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java b/core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java index c1aece49c88..4a7f67fb68f 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java @@ -126,7 +126,7 @@ abstract class AbstractExchange implements Exchange { if (parent.hasVariables()) { if (this.variableRepository == null) { - this.variableRepository = new ExchangeVariableRepository(); + this.variableRepository = new ExchangeVariableRepository(getContext()); } this.variableRepository.setVariables(parent.getVariables()); @@ -403,7 +403,7 @@ abstract class AbstractExchange implements Exchange { @Override public void setVariable(String name, Object value) { if (variableRepository == null) { - variableRepository = new ExchangeVariableRepository(); + variableRepository = new ExchangeVariableRepository(getContext()); } variableRepository.setVariable(name, value); } @@ -424,7 +424,7 @@ abstract class AbstractExchange implements Exchange { public Map<String, Object> getVariables() { if (variableRepository == null) { // force creating variables - variableRepository = new ExchangeVariableRepository(); + variableRepository = new ExchangeVariableRepository(getContext()); } return variableRepository.getVariables(); } diff --git a/core/camel-support/src/main/java/org/apache/camel/support/ExchangeVariableRepository.java b/core/camel-support/src/main/java/org/apache/camel/support/ExchangeVariableRepository.java index b913ef26056..2101982bf4a 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/ExchangeVariableRepository.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/ExchangeVariableRepository.java @@ -20,9 +20,12 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; +import org.apache.camel.CamelContext; +import org.apache.camel.CamelContextAware; import org.apache.camel.Exchange; import org.apache.camel.NonManagedService; import org.apache.camel.StreamCache; +import org.apache.camel.converter.stream.CachedOutputStream; import org.apache.camel.spi.BrowsableVariableRepository; import org.apache.camel.spi.VariableRepository; import org.apache.camel.support.service.ServiceSupport; @@ -35,6 +38,11 @@ import org.apache.camel.util.StringHelper; class ExchangeVariableRepository extends ServiceSupport implements BrowsableVariableRepository, NonManagedService { private final Map<String, Object> variables = new ConcurrentHashMap<>(8); + private final CamelContext camelContext; + + public ExchangeVariableRepository(CamelContext camelContext) { + this.camelContext = camelContext; + } @Override public String getId() { @@ -66,6 +74,17 @@ class ExchangeVariableRepository extends ServiceSupport implements BrowsableVari @Override public void setVariable(String name, Object value) { + // special for some values that are CachedOutputStream which we want to be re-readable and therefore + // convert this to StreamCache + // TODO: Do something like StreamCachingHelper + // TODO: support base class that has stream caching stuff for set/getVariable + if (camelContext.isStreamCaching()) + return StreamCachingHelper.convertToStreamCache(strategy, exchange, exchange.getIn()); + Object cache = camelContext.getTypeConverter().tryConvertTo(StreamCache.class, value); + if (cache != null) { + value = cache; + } + } if (value != null) { // avoid the NullPointException variables.put(name, value); diff --git a/core/camel-support/src/main/java/org/apache/camel/support/SingleInputLanguageSupport.java b/core/camel-support/src/main/java/org/apache/camel/support/SingleInputLanguageSupport.java index 86703cea8f5..eabffb5a5a7 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/SingleInputLanguageSupport.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/SingleInputLanguageSupport.java @@ -23,16 +23,20 @@ import org.apache.camel.spi.Language; */ public abstract class SingleInputLanguageSupport extends LanguageSupport { - /** - * Name of header to use as input, instead of the message body - */ + private String variableName; private String headerName; + private String propertyName; + + public String getVariableName() { + return variableName; + } + /** - * Name of property to use as input, instead of the message body. - * <p> - * It has a lower precedent than the name of header if both are set. + * Name of variable to use as input, instead of the message body */ - private String propertyName; + public void setVariableName(String variableName) { + this.variableName = variableName; + } public String getHeaderName() { return headerName; diff --git a/core/camel-support/src/main/java/org/apache/camel/support/SingleInputTypedLanguageSupport.java b/core/camel-support/src/main/java/org/apache/camel/support/SingleInputTypedLanguageSupport.java index 3965287b485..9e1f98a8805 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/SingleInputTypedLanguageSupport.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/SingleInputTypedLanguageSupport.java @@ -25,16 +25,22 @@ import org.apache.camel.support.builder.ExpressionBuilder; */ public abstract class SingleInputTypedLanguageSupport extends TypedLanguageSupport { - /** - * Name of header to use as input, instead of the message body - */ + private String variableName; private String headerName; + private String propertyName; + + public String getVariableName() { + return variableName; + } + /** - * Name of property to use as input, instead of the message body. - * <p> - * It has a lower precedent than the name of header if both are set. + * Name of variable to use as input, instead of the message body + * </p> + * It has as higher precedent if other are set. */ - private String propertyName; + public void setVariableName(String variableName) { + this.variableName = variableName; + } public String getHeaderName() { return headerName; @@ -63,9 +69,10 @@ public abstract class SingleInputTypedLanguageSupport extends TypedLanguageSuppo @Override public Expression createExpression(String expression, Object[] properties) { Class<?> type = property(Class.class, properties, 0, getResultType()); - String header = property(String.class, properties, 1, getHeaderName()); - String property = property(String.class, properties, 2, getPropertyName()); - Expression source = ExpressionBuilder.singleInputExpression(header, property); + String variable = property(String.class, properties, 1, getVariableName()); + String header = property(String.class, properties, 2, getHeaderName()); + String property = property(String.class, properties, 3, getPropertyName()); + Expression source = ExpressionBuilder.singleInputExpression(variable, header, property); if (type == null || type == Object.class) { return createExpression(source, expression, properties); } diff --git a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java index 12271bde384..4853d3eafe7 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java @@ -1142,15 +1142,19 @@ public class ExpressionBuilder { } /** + * @param variableName the name of the variable from which the input data must be extracted if not empty. * @param headerName the name of the header from which the input data must be extracted if not empty. * @param propertyName the name of the property from which the input data must be extracted if not empty and * {@code headerName} is empty. - * @return a header expression if {@code headerName} is not empty, otherwise a property expression if + * @return a variable expression if {@code variableName} is not empty, + * a header expression if {@code headerName} is not empty, otherwise a property expression if * {@code propertyName} is not empty or finally a body expression. */ - public static Expression singleInputExpression(String headerName, String propertyName) { + public static Expression singleInputExpression(String variableName, String headerName, String propertyName) { final Expression exp; - if (ObjectHelper.isNotEmpty(headerName)) { + if (ObjectHelper.isNotEmpty(variableName)) { + exp = variableExpression(variableName); + } else if (ObjectHelper.isNotEmpty(headerName)) { exp = headerExpression(headerName); } else if (ObjectHelper.isNotEmpty(propertyName)) { exp = exchangePropertyExpression(propertyName); @@ -1163,7 +1167,6 @@ public class ExpressionBuilder { /** * Returns the expression for the current thread id */ - public static Expression threadIdExpression() { return new ExpressionAdapter() { @Override diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java index 60132d4ae6f..4ae07023836 100644 --- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java +++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java @@ -2895,6 +2895,7 @@ public class ModelParser extends BaseParser { switch (key) { case "headerName": def.setHeaderName(val); break; case "propertyName": def.setPropertyName(val); break; + case "variableName": def.setVariableName(val); break; default: return typedExpressionDefinitionAttributeHandler().accept(def, key, val); } return true; diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java index 6399d61082a..d80ec03e463 100644 --- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java +++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java @@ -4161,6 +4161,7 @@ public class ModelWriter extends BaseWriter { throws IOException { doWriteTypedExpressionDefinitionAttributes(def); doWriteAttribute("headerName", def.getHeaderName()); + doWriteAttribute("variableName", def.getVariableName()); doWriteAttribute("propertyName", def.getPropertyName()); } protected void doWriteSingleInputTypedExpressionDefinition( diff --git a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java index fdfcdce5f8b..0a61565954b 100644 --- a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java +++ b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java @@ -4161,6 +4161,7 @@ public class ModelWriter extends BaseWriter { throws IOException { doWriteTypedExpressionDefinitionAttributes(def); doWriteAttribute("headerName", def.getHeaderName()); + doWriteAttribute("variableName", def.getVariableName()); doWriteAttribute("propertyName", def.getPropertyName()); } protected void doWriteSingleInputTypedExpressionDefinition( diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java index 2e7c0d1ff1e..5e10764e353 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java @@ -6871,7 +6871,8 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "id", type = "string", description = "Sets the id of this node", displayName = "Id"), @YamlProperty(name = "propertyName", type = "string", description = "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set.", displayName = "Property Name"), @YamlProperty(name = "resultType", type = "string", description = "Sets the class of the result type (type from output)", displayName = "Result Type"), - @YamlProperty(name = "trim", type = "boolean", description = "Whether to trim the value to remove leading and trailing whitespaces and line breaks", displayName = "Trim") + @YamlProperty(name = "trim", type = "boolean", description = "Whether to trim the value to remove leading and trailing whitespaces and line breaks", displayName = "Trim"), + @YamlProperty(name = "variableName", type = "string", description = "Name of variable to use as input, instead of the message body It has as higher precedent if other are set.", displayName = "Variable Name") } ) public static class Hl7TerserExpressionDeserializer extends YamlDeserializerBase<Hl7TerserExpression> { @@ -6924,6 +6925,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setTrim(val); break; } + case "variableName": { + String val = asText(node); + target.setVariableName(val); + break; + } default: { ExpressionDefinition ed = target.getExpressionType(); if (ed != null) { @@ -7939,7 +7945,8 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "id", type = "string", description = "Sets the id of this node", displayName = "Id"), @YamlProperty(name = "propertyName", type = "string", description = "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set.", displayName = "Property Name"), @YamlProperty(name = "resultType", type = "string", description = "Sets the class of the result type (type from output)", displayName = "Result Type"), - @YamlProperty(name = "trim", type = "boolean", description = "Whether to trim the value to remove leading and trailing whitespaces and line breaks", displayName = "Trim") + @YamlProperty(name = "trim", type = "boolean", description = "Whether to trim the value to remove leading and trailing whitespaces and line breaks", displayName = "Trim"), + @YamlProperty(name = "variableName", type = "string", description = "Name of variable to use as input, instead of the message body It has as higher precedent if other are set.", displayName = "Variable Name") } ) public static class JqExpressionDeserializer extends YamlDeserializerBase<JqExpression> { @@ -7992,6 +7999,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setTrim(val); break; } + case "variableName": { + String val = asText(node); + target.setVariableName(val); + break; + } default: { ExpressionDefinition ed = target.getExpressionType(); if (ed != null) { @@ -8253,6 +8265,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "suppressExceptions", type = "boolean", description = "Whether to suppress exceptions such as PathNotFoundException.", displayName = "Suppress Exceptions"), @YamlProperty(name = "trim", type = "boolean", description = "Whether to trim the value to remove leading and trailing whitespaces and line breaks", displayName = "Trim"), @YamlProperty(name = "unpackArray", type = "boolean", description = "Whether to unpack a single element json-array into an object.", displayName = "Unpack Array"), + @YamlProperty(name = "variableName", type = "string", description = "Name of variable to use as input, instead of the message body It has as higher precedent if other are set.", displayName = "Variable Name"), @YamlProperty(name = "writeAsString", type = "boolean", description = "Whether to write the output of each row/element as a JSON String value instead of a Map/POJO value.", displayName = "Write As String") } ) @@ -8331,6 +8344,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setUnpackArray(val); break; } + case "variableName": { + String val = asText(node); + target.setVariableName(val); + break; + } case "writeAsString": { String val = asText(node); target.setWriteAsString(val); diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json index 6b37183070a..fdddfca3136 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json @@ -13063,6 +13063,11 @@ "type" : "boolean", "title" : "Trim", "description" : "Whether to trim the value to remove leading and trailing whitespaces and line breaks" + }, + "variableName" : { + "type" : "string", + "title" : "Variable Name", + "description" : "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." } } } ], @@ -13226,6 +13231,11 @@ "type" : "boolean", "title" : "Trim", "description" : "Whether to trim the value to remove leading and trailing whitespaces and line breaks" + }, + "variableName" : { + "type" : "string", + "title" : "Variable Name", + "description" : "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." } } } ], @@ -13296,6 +13306,11 @@ "title" : "Unpack Array", "description" : "Whether to unpack a single element json-array into an object." }, + "variableName" : { + "type" : "string", + "title" : "Variable Name", + "description" : "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." + }, "writeAsString" : { "type" : "boolean", "title" : "Write As String",
