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 2022/01/12 11:46:23 UTC

[camel-kamelets] branch main updated (46d26fe -> 47a18c2)

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

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


    from 46d26fe  Regen after official wrapper added
     new 090fc3a  Replace Field Action: disabled and enabled are mandatory
     new c0039df  Replace Field Action: disabled and enabled are mandatory
     new 6be1601  Replace Field Action: disabled and enabled are mandatory
     new 24e0ea0  Replace Field Action: disabled and enabled are mandatory
     new 47a18c2  Replace Field Action: disabled and enabled are mandatory

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 kamelets/replace-field-action.kamelet.yaml         | 20 ++++++++++++++++---
 .../kamelets/utils/transform/ReplaceField.java     | 23 ++++++++++++----------
 .../kamelets/replace-field-action.kamelet.yaml     | 20 ++++++++++++++++---
 3 files changed, 47 insertions(+), 16 deletions(-)

[camel-kamelets] 02/05: Replace Field Action: disabled and enabled are mandatory

Posted by ac...@apache.org.
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-kamelets.git

commit c0039df07a9a10dd506e2e6c379ddb473f3865de
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Jan 12 11:53:45 2022 +0100

    Replace Field Action: disabled and enabled are mandatory
---
 kamelets/replace-field-action.kamelet.yaml | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/kamelets/replace-field-action.kamelet.yaml b/kamelets/replace-field-action.kamelet.yaml
index 6340e16..b0fc154 100644
--- a/kamelets/replace-field-action.kamelet.yaml
+++ b/kamelets/replace-field-action.kamelet.yaml
@@ -29,7 +29,18 @@ metadata:
 spec:
   definition:
     title: "Replace Field Action"
-    description: "Replace field with a different key in the message in transit"
+    description: |-
+      Replace field with a different key in the message in transit.
+
+      The required parameter 'renames' is a comma-separated list of colon-delimited renaming pairs like for example 'foo:bar,abc:xyz' and it represents the field rename mappings.
+
+      The optional parameter 'enabled' represents the fields to include. If specified, only the named fields will be included in the resulting message.
+
+      The optional parameter 'disabled' represents the fields to exclude. If specified, the listed fields will be excluded from the resulting message. This takes precedence over the 'enabled' parameter.
+
+      The default value of 'enabled' parameter is 'all', so all the fields of the payload will be included.
+
+      The default value of 'disabled' parameter is 'none', so no fields of the payload will be excluded.
     required:
       - renames
     properties:

[camel-kamelets] 05/05: Replace Field Action: disabled and enabled are mandatory

Posted by ac...@apache.org.
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-kamelets.git

commit 47a18c2dfc2ad5367fe88515e463dc96bef725d3
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Jan 12 12:25:02 2022 +0100

    Replace Field Action: disabled and enabled are mandatory
---
 .../src/main/resources/kamelets/replace-field-action.kamelet.yaml      | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/library/camel-kamelets/src/main/resources/kamelets/replace-field-action.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/replace-field-action.kamelet.yaml
index b0fc154..c7bcbec 100644
--- a/library/camel-kamelets/src/main/resources/kamelets/replace-field-action.kamelet.yaml
+++ b/library/camel-kamelets/src/main/resources/kamelets/replace-field-action.kamelet.yaml
@@ -60,6 +60,9 @@ spec:
         type: string
         example: "foo:bar,c1:c2"
     type: object
+  types:
+    in:
+      mediaType: application/json
   dependencies:
   - "github:apache.camel-kamelets:camel-kamelets-utils:main-SNAPSHOT"
   - "camel:core"

[camel-kamelets] 03/05: Replace Field Action: disabled and enabled are mandatory

Posted by ac...@apache.org.
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-kamelets.git

commit 6be1601753a74850e49d54c377aea4618dbedd8b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Jan 12 12:01:28 2022 +0100

    Replace Field Action: disabled and enabled are mandatory
---
 .../resources/kamelets/replace-field-action.kamelet.yaml    | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/library/camel-kamelets/src/main/resources/kamelets/replace-field-action.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/replace-field-action.kamelet.yaml
index 6340e16..b0fc154 100644
--- a/library/camel-kamelets/src/main/resources/kamelets/replace-field-action.kamelet.yaml
+++ b/library/camel-kamelets/src/main/resources/kamelets/replace-field-action.kamelet.yaml
@@ -29,7 +29,18 @@ metadata:
 spec:
   definition:
     title: "Replace Field Action"
-    description: "Replace field with a different key in the message in transit"
+    description: |-
+      Replace field with a different key in the message in transit.
+
+      The required parameter 'renames' is a comma-separated list of colon-delimited renaming pairs like for example 'foo:bar,abc:xyz' and it represents the field rename mappings.
+
+      The optional parameter 'enabled' represents the fields to include. If specified, only the named fields will be included in the resulting message.
+
+      The optional parameter 'disabled' represents the fields to exclude. If specified, the listed fields will be excluded from the resulting message. This takes precedence over the 'enabled' parameter.
+
+      The default value of 'enabled' parameter is 'all', so all the fields of the payload will be included.
+
+      The default value of 'disabled' parameter is 'none', so no fields of the payload will be excluded.
     required:
       - renames
     properties:

[camel-kamelets] 04/05: Replace Field Action: disabled and enabled are mandatory

Posted by ac...@apache.org.
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-kamelets.git

commit 24e0ea010c484801eef688ad70cb16fff15c10b6
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Jan 12 12:24:12 2022 +0100

    Replace Field Action: disabled and enabled are mandatory
---
 kamelets/replace-field-action.kamelet.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kamelets/replace-field-action.kamelet.yaml b/kamelets/replace-field-action.kamelet.yaml
index b0fc154..c7bcbec 100644
--- a/kamelets/replace-field-action.kamelet.yaml
+++ b/kamelets/replace-field-action.kamelet.yaml
@@ -60,6 +60,9 @@ spec:
         type: string
         example: "foo:bar,c1:c2"
     type: object
+  types:
+    in:
+      mediaType: application/json
   dependencies:
   - "github:apache.camel-kamelets:camel-kamelets-utils:main-SNAPSHOT"
   - "camel:core"

[camel-kamelets] 01/05: Replace Field Action: disabled and enabled are mandatory

Posted by ac...@apache.org.
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-kamelets.git

commit 090fc3a850c0df6d4cb0bf9896aa66a10250bec6
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Jan 12 11:29:46 2022 +0100

    Replace Field Action: disabled and enabled are mandatory
---
 kamelets/replace-field-action.kamelet.yaml         |  4 ++--
 .../kamelets/utils/transform/ReplaceField.java     | 23 ++++++++++++----------
 .../kamelets/replace-field-action.kamelet.yaml     |  4 ++--
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/kamelets/replace-field-action.kamelet.yaml b/kamelets/replace-field-action.kamelet.yaml
index 090bfc0..6340e16 100644
--- a/kamelets/replace-field-action.kamelet.yaml
+++ b/kamelets/replace-field-action.kamelet.yaml
@@ -31,18 +31,18 @@ spec:
     title: "Replace Field Action"
     description: "Replace field with a different key in the message in transit"
     required:
-      - enabled
-      - disabled
       - renames
     properties:
       enabled:
         title: Enabled
         description: Comma separated list of fields to be enabled
         type: string
+        default: "all"
       disabled:
         title: Disabled
         description: Comma separated list of fields to be disabled
         type: string
+        default: "none"
       renames:
         title: Renames
         description: Comma separated list of field with new value to be renamed
diff --git a/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/transform/ReplaceField.java b/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/transform/ReplaceField.java
index 518fa28..7640ddc 100644
--- a/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/transform/ReplaceField.java
+++ b/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/transform/ReplaceField.java
@@ -40,24 +40,27 @@ public class ReplaceField {
         List<String> renameFields = new ArrayList<>();
         JsonNode jsonNodeBody = ex.getMessage().getBody(JsonNode.class);
         Map<Object, Object> body = mapper.convertValue(jsonNodeBody, new TypeReference<Map<Object, Object>>(){});
-        if (ObjectHelper.isNotEmpty(enabled)) {
+        if (ObjectHelper.isNotEmpty(enabled) && !enabled.equalsIgnoreCase("all")) {
             enabledFields = Arrays.stream(enabled.split(",")).collect(Collectors.toList());
         }
-        if (ObjectHelper.isNotEmpty(disabled)) {
+        if (ObjectHelper.isNotEmpty(disabled) && !disabled.equalsIgnoreCase("none")) {
             disabledFields = Arrays.stream(disabled.split(",")).collect(Collectors.toList());
         }
         if (ObjectHelper.isNotEmpty(disabled)) {
             renameFields = Arrays.stream(renames.split(",")).collect(Collectors.toList());
         }
-
-        Map<String, String> renamingMap = parseNames(renameFields);
         Map<Object, Object> updatedBody = new HashMap<>();
-        for (Map.Entry entry:
-             body.entrySet()) {
-            final String fieldName = (String) entry.getKey();
-            if (filterNames(fieldName, enabledFields, disabledFields)) {
-                final Object fieldValue = entry.getValue();
-                updatedBody.put(renameOptional(fieldName, renamingMap), fieldValue);
+
+        if (ObjectHelper.isNotEmpty(renameFields)) {
+            Map<String, String> renamingMap = parseNames(renameFields);
+
+            for (Map.Entry entry :
+                    body.entrySet()) {
+                final String fieldName = (String) entry.getKey();
+                if (filterNames(fieldName, enabledFields, disabledFields)) {
+                    final Object fieldValue = entry.getValue();
+                    updatedBody.put(renameOptional(fieldName, renamingMap), fieldValue);
+                }
             }
         }
         if (!updatedBody.isEmpty()) {
diff --git a/library/camel-kamelets/src/main/resources/kamelets/replace-field-action.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/replace-field-action.kamelet.yaml
index 090bfc0..6340e16 100644
--- a/library/camel-kamelets/src/main/resources/kamelets/replace-field-action.kamelet.yaml
+++ b/library/camel-kamelets/src/main/resources/kamelets/replace-field-action.kamelet.yaml
@@ -31,18 +31,18 @@ spec:
     title: "Replace Field Action"
     description: "Replace field with a different key in the message in transit"
     required:
-      - enabled
-      - disabled
       - renames
     properties:
       enabled:
         title: Enabled
         description: Comma separated list of fields to be enabled
         type: string
+        default: "all"
       disabled:
         title: Disabled
         description: Comma separated list of fields to be disabled
         type: string
+        default: "none"
       renames:
         title: Renames
         description: Comma separated list of field with new value to be renamed