[ 
https://issues.apache.org/jira/browse/UNOMI-132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16226757#comment-16226757
 ] 

Don Hinshaw commented on UNOMI-132:
-----------------------------------

Serge,

I was using the default merge strategy.  If you look here... 
{code:java}
        for (Profile profileToMerge : profilesToMerge) {
            if (profileToMerge.getProperty(propertyName) != null &&
                    
profileToMerge.getProperty(propertyName).toString().length() > 0) {
                targetProfile.setProperty(propertyName, 
profileToMerge.getProperty(propertyName));
                modified = true;
            }
        }
{code}

It will getProperty("group"), which has the list of user_ids and it will 
setProperty("group") with that list.  So the list from profileToMerge 
overwrites the list from targetProfile.

Is there a particular merge strategy I should look at?

Thanks,
Donnie

> ProfileServiceImpl mergeProfiles for nested profile properties
> --------------------------------------------------------------
>
>                 Key: UNOMI-132
>                 URL: https://issues.apache.org/jira/browse/UNOMI-132
>             Project: Apache Unomi
>          Issue Type: Wish
>            Reporter: Don Hinshaw
>            Priority: Minor
>
> When merging profiles unomi does not look for profile properties that are 
> nested.
> {code:javascript}
>    "properties": {
>         "nbOfVisits": 1,
>         "lastVisit": "2017-10-25T20:04:49Z",
>         "group": {
>             "user_ids": {
>                 "site_1": "123_user_id"
>             }
>         },
>         "firstVisit": "2017-10-25T20:04:49Z",
>     }
> {code}
> When this profile gets merged, unomi looks for the properties on line 458 in 
> ProfileServiceImpl.
> {code:java}
> allProfileProperties.addAll(profile.getProperties().keySet());
> {code}
> The keySet() will only include "group", not the values nested inside.  So we 
> cannot define a mergeRule for the values inside.
> How can we merge two profiles with different user_id values?
> Current work around is to use 
> {code:javascript} group_user-id_site-1 : "123_user_id" {code}
> instead of the nested property.
> Any thoughts or is this a new use case?
> Thanks,
> Donnie



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to