This is an automated email from the ASF dual-hosted git repository. shuber pushed a commit to branch unomi-1.5.x in repository https://gitbox.apache.org/repos/asf/unomi.git
commit 8b50dbf81144cec039a2dd807dc4800163a6225b Author: giladw <[email protected]> AuthorDate: Fri Feb 5 15:44:43 2021 +0200 mergePropertyAction: when merge identifier change, if forceEventProfile, change identifier and do not create a new profile (#239) (cherry picked from commit 107011a1d948db6ef8fc5b0217bd58afeb6a20b4) --- .../baseplugin/actions/MergeProfilesOnPropertyAction.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java index b01990b..93036d7 100644 --- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java +++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java @@ -70,6 +70,9 @@ public class MergeProfilesOnPropertyAction implements ActionExecutor { final Session currentSession = event.getSession(); + boolean forceEventProfileAsMaster = action.getParameterValues().containsKey("forceEventProfileAsMaster") ? + (boolean) action.getParameterValues().get("forceEventProfileAsMaster") : false; + // store the profile id in case the merge change it to a previous one String profileId = profile.getItemId(); @@ -95,8 +98,12 @@ public class MergeProfilesOnPropertyAction implements ActionExecutor { profile = profiles.get(0); } else { // Create a new profile - profile = new Profile(UUID.randomUUID().toString()); - profile.setProperty("firstVisit", event.getTimeStamp()); + if (forceEventProfileAsMaster) + profile = event.getProfile(); + else { + profile = new Profile(UUID.randomUUID().toString()); + profile.setProperty("firstVisit", event.getTimeStamp()); + } profile.getSystemProperties().put(mergeProfilePropertyName, mergeProfilePropertyValue); } @@ -133,8 +140,6 @@ public class MergeProfilesOnPropertyAction implements ActionExecutor { } Profile markedMasterProfile; - boolean forceEventProfileAsMaster = action.getParameterValues().containsKey("forceEventProfileAsMaster") ? - (boolean) action.getParameterValues().get("forceEventProfileAsMaster") : false; if (forceEventProfileAsMaster) markedMasterProfile = event.getProfile(); else
