You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2021/01/06 07:55:52 UTC

[unomi] branch master updated: feat(updatePropertiesAction): support add values to a SET in a profile property (#230)

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

shuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/master by this push:
     new 9512fa7  feat(updatePropertiesAction): support add values to a SET in a profile property (#230)
9512fa7 is described below

commit 9512fa7991e2b889673fdc712301d2466d054ea3
Author: giladw <gw...@yotpo.com>
AuthorDate: Wed Jan 6 09:55:42 2021 +0200

    feat(updatePropertiesAction): support add values to a SET in a profile property (#230)
---
 .../unomi/plugins/baseplugin/actions/UpdatePropertiesAction.java    | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/UpdatePropertiesAction.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/UpdatePropertiesAction.java
index 04d2e9b..ef175d9 100644
--- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/UpdatePropertiesAction.java
+++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/UpdatePropertiesAction.java
@@ -37,6 +37,7 @@ public class UpdatePropertiesAction implements ActionExecutor {
     public static final String PROPS_TO_ADD = "add";
     public static final String PROPS_TO_UPDATE = "update";
     public static final String PROPS_TO_DELETE = "delete";
+    public static final String PROPS_TO_ADD_TO_SET  = "addToSet";
 
     public static final String TARGET_ID_KEY = "targetId";
     public static final String TARGET_TYPE_KEY = "targetType";
@@ -76,6 +77,11 @@ public class UpdatePropertiesAction implements ActionExecutor {
             isProfileOrPersonaUpdated |= processProperties(target, propsToUpdate, "alwaysSet");
         }
 
+        Map<String, Object> propsToAddToSet = (HashMap<String, Object>) event.getProperties().get(PROPS_TO_ADD_TO_SET);
+        if (propsToAddToSet != null) {
+            isProfileOrPersonaUpdated |= processProperties(target, propsToAddToSet, "addValues");
+        }
+
         List<String> propsToDelete = (List<String>) event.getProperties().get(PROPS_TO_DELETE);
         if (propsToDelete != null) {
             for (String prop : propsToDelete) {