Repository: incubator-unomi Updated Branches: refs/heads/master fe4d27b89 -> a6b1e3a94
DMF-2028 Multiple regressions since last deployment - Make sure even properties that have no type are still updated. Signed-off-by: Serge Huber <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/a6b1e3a9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/a6b1e3a9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/a6b1e3a9 Branch: refs/heads/master Commit: a6b1e3a94b2afdb19dc392f7bb9ad1fa986b5df4 Parents: fe4d27b Author: Serge Huber <[email protected]> Authored: Mon Oct 16 12:06:52 2017 +0200 Committer: Serge Huber <[email protected]> Committed: Mon Oct 16 12:06:52 2017 +0200 ---------------------------------------------------------------------- .../baseplugin/actions/SetPropertyAction.java | 2 +- .../actions/UpdateProfilePropertiesAction.java | 23 +++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/a6b1e3a9/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/SetPropertyAction.java ---------------------------------------------------------------------- diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/SetPropertyAction.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/SetPropertyAction.java index 8da3b0f..ed857bd 100644 --- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/SetPropertyAction.java +++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/SetPropertyAction.java @@ -46,7 +46,7 @@ public class SetPropertyAction implements ActionExecutor { Object setPropertyValueMultiple = action.getParameterValues().get("setPropertyValueMultiple"); Object setPropertyValueBoolean = action.getParameterValues().get("setPropertyValueBoolean"); - Event updateProfileProperties = new Event("updateProfileProperties", null, event.getProfile(), null, null, event.getProfile(), new Date()); + Event updateProfileProperties = new Event("updateProfileProperties", event.getSession(), event.getProfile(), event.getScope(), null, event.getProfile(), new Date()); updateProfileProperties.setPersistent(false); if (propertyValue == null) { http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/a6b1e3a9/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/UpdateProfilePropertiesAction.java ---------------------------------------------------------------------- diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/UpdateProfilePropertiesAction.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/UpdateProfilePropertiesAction.java index d39eb0f..4a68a3b 100644 --- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/UpdateProfilePropertiesAction.java +++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/UpdateProfilePropertiesAction.java @@ -33,7 +33,6 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.regex.Pattern; public class UpdateProfilePropertiesAction implements ActionExecutor { @@ -64,10 +63,14 @@ public class UpdateProfilePropertiesAction implements ActionExecutor { Map<String, Object> propsToAdd = (HashMap<String, Object>) event.getProperties().get(PROPS_TO_ADD); if (propsToAdd != null) { for (String prop : propsToAdd.keySet()) { - String[] splitPropName = prop.split(Pattern.quote(".")); - PropertyType propType = profileService.getPropertyType(splitPropName[splitPropName.length - 1]); + PropertyType propType = null; + if (prop.startsWith("properties.")) { + propType = profileService.getPropertyType(prop.substring("properties.".length())); + } if (propType != null) { isProfileUpdated |= PropertyHelper.setProperty(target, prop, PropertyHelper.getValueByTypeId(propsToAdd.get(prop), propType.getValueTypeId()), "setIfMissing"); + } else { + isProfileUpdated |= PropertyHelper.setProperty(target, prop, propsToAdd.get(prop), "setIfMissing"); } } } @@ -75,10 +78,14 @@ public class UpdateProfilePropertiesAction implements ActionExecutor { Map<String, Object> propsToUpdate = (HashMap<String, Object>) event.getProperties().get(PROPS_TO_UPDATE); if (propsToUpdate != null) { for (String prop : propsToUpdate.keySet()) { - String[] splitPropName = prop.split(Pattern.quote(".")); - PropertyType propType = profileService.getPropertyType(splitPropName[splitPropName.length - 1]); + PropertyType propType = null; + if (prop.startsWith("properties.")) { + propType = profileService.getPropertyType(prop.substring("properties.".length())); + } if (propType != null) { isProfileUpdated |= PropertyHelper.setProperty(target, prop, PropertyHelper.getValueByTypeId(propsToUpdate.get(prop), propType.getValueTypeId()), "alwaysSet"); + } else { + isProfileUpdated |= PropertyHelper.setProperty(target, prop, propsToUpdate.get(prop), "alwaysSet"); } } } @@ -86,11 +93,7 @@ public class UpdateProfilePropertiesAction implements ActionExecutor { List<String> propsToDelete = (List<String>) event.getProperties().get(PROPS_TO_DELETE); if (propsToDelete != null) { for (String prop : propsToDelete) { - String[] splitPropName = prop.split(Pattern.quote(".")); - PropertyType propType = profileService.getPropertyType(splitPropName[splitPropName.length - 1]); - if (propType != null) { - isProfileUpdated |= PropertyHelper.setProperty(target, prop, null, "remove"); - } + isProfileUpdated |= PropertyHelper.setProperty(target, prop, null, "remove"); } }
