You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by "Kevan Jahanshahi (Jira)" <ji...@apache.org> on 2022/07/19 15:49:00 UTC
[jira] [Updated] (UNOMI-628) Stop creating aliases for new profiles and only create alias automatically during the merge.
[ https://issues.apache.org/jira/browse/UNOMI-628?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kevan Jahanshahi updated UNOMI-628:
-----------------------------------
Description:
Due to the fact that every profile is creating is own alias on him self. like this:
{code:java}
{
"_index": "context-profilealias",
"_type": "_doc",
"_id": "fa31e995-884d-48b3-8ece-8378e7dd6351",
"_version": 1,
"_score": 1,
"_source": {
"itemId": "fa31e995-884d-48b3-8ece-8378e7dd6351",
"itemType": "profileAlias",
"profileID": "fa31e995-884d-48b3-8ece-8378e7dd6351",
"clientID": "defaultClientId",
"creationTime": "2022-07-08T15:39:40Z",
"modifiedTime": "2022-07-08T15:39:40Z"
}
}
{code}
When the merge system is trying to merge 2 profiles. both profiles already have there own respective useless alias.
So it fail trying to create a useful alias, because a useless alias already exists.
The code responsible to that is pretty clear:
{code:java}
@Override
public void addAliasToProfile(String profileID, String alias, String clientID) {
ProfileAlias profileAlias = persistenceService.load(alias, ProfileAlias.class);
if (profileAlias == null) {
profileAlias = new ProfileAlias();
profileAlias.setItemId(alias);
profileAlias.setItemType(ProfileAlias.ITEM_TYPE);
profileAlias.setProfileID(profileID);
profileAlias.setClientID(clientID);
Date creationTime = new Date();
profileAlias.setCreationTime(creationTime);
profileAlias.setModifiedTime(creationTime);
persistenceService.save(profileAlias);
} else if (!Objects.equals(profileAlias.getProfileID(), profileID)) {
throw new IllegalArgumentException("Alias \"" + alias + "\" already used by profile with ID = \"" + profileID + "\"");
}
}
{code}
Also the error message is not correct, it should be:
{code:java}
throw new IllegalArgumentException("Alias \"" + alias + "\" already used by profile with ID = \"" + profileAlias.getProfileID() + "\"");
{code}
{color:#172b4d}*TODO:*{color}
* {color:#172b4d}*remove the creation of alias on new profile, and only create aliases during the merge*{color}
* {color:#172b4d}*Fix the error message to be more clear like mentioned.*{color}
* {color:#172b4d}*Add missing integration test and/or provide better integration test regarding the alias + merge logic.*{color}
was:
Due to the fact that every profile is creating is own alias on him self. like this:
{code:java}
{
"_index": "context-profilealias",
"_type": "_doc",
"_id": "fa31e995-884d-48b3-8ece-8378e7dd6351",
"_version": 1,
"_score": 1,
"_source": {
"itemId": "fa31e995-884d-48b3-8ece-8378e7dd6351",
"itemType": "profileAlias",
"profileID": "fa31e995-884d-48b3-8ece-8378e7dd6351",
"clientID": "defaultClientId",
"creationTime": "2022-07-08T15:39:40Z",
"modifiedTime": "2022-07-08T15:39:40Z"
}
}
{code}
When the merge system is trying to merge 2 profiles. both profiles already have there own respective useless alias.
So it fail trying to create a useful alias, because a useless alias already exists.
The code responsible to that is pretty clear:
{code:java}
@Override
public void addAliasToProfile(String profileID, String alias, String clientID) {
ProfileAlias profileAlias = persistenceService.load(alias, ProfileAlias.class);
if (profileAlias == null) {
profileAlias = new ProfileAlias();
profileAlias.setItemId(alias);
profileAlias.setItemType(ProfileAlias.ITEM_TYPE);
profileAlias.setProfileID(profileID);
profileAlias.setClientID(clientID);
Date creationTime = new Date();
profileAlias.setCreationTime(creationTime);
profileAlias.setModifiedTime(creationTime);
persistenceService.save(profileAlias);
} else if (!Objects.equals(profileAlias.getProfileID(), profileID)) {
throw new IllegalArgumentException("Alias \"" + alias + "\" already used by profile with ID = \"" + profileID + "\"");
}
}
{code}
Also the error message is not correct, it should be:
{code:java}
throw new IllegalArgumentException("Alias \"" + alias + "\" already used by profile with ID = \"" + profileAlias.getProfileID() + "\"");
{code}
{color:#de350b}*TODO:*{color}
* {color:#de350b}*remove the creation of alias on new profile, and only create aliases during the merge*{color}
* {color:#de350b}*Fix the error message to be more clear like mentioned.*{color}{*}{*}
* {color:#de350b}*Add missing integration test and/or provide better integration test regarding the alias + merge logic.*{color}
> Stop creating aliases for new profiles and only create alias automatically during the merge.
> --------------------------------------------------------------------------------------------
>
> Key: UNOMI-628
> URL: https://issues.apache.org/jira/browse/UNOMI-628
> Project: Apache Unomi
> Issue Type: Bug
> Affects Versions: 2.0.0
> Reporter: Kevan Jahanshahi
> Priority: Major
> Fix For: 2.0.0
>
>
> Due to the fact that every profile is creating is own alias on him self. like this:
> {code:java}
> {
> "_index": "context-profilealias",
> "_type": "_doc",
> "_id": "fa31e995-884d-48b3-8ece-8378e7dd6351",
> "_version": 1,
> "_score": 1,
> "_source": {
> "itemId": "fa31e995-884d-48b3-8ece-8378e7dd6351",
> "itemType": "profileAlias",
> "profileID": "fa31e995-884d-48b3-8ece-8378e7dd6351",
> "clientID": "defaultClientId",
> "creationTime": "2022-07-08T15:39:40Z",
> "modifiedTime": "2022-07-08T15:39:40Z"
> }
> }
> {code}
> When the merge system is trying to merge 2 profiles. both profiles already have there own respective useless alias.
> So it fail trying to create a useful alias, because a useless alias already exists.
> The code responsible to that is pretty clear:
> {code:java}
> @Override
> public void addAliasToProfile(String profileID, String alias, String clientID) {
> ProfileAlias profileAlias = persistenceService.load(alias, ProfileAlias.class);
> if (profileAlias == null) {
> profileAlias = new ProfileAlias();
> profileAlias.setItemId(alias);
> profileAlias.setItemType(ProfileAlias.ITEM_TYPE);
> profileAlias.setProfileID(profileID);
> profileAlias.setClientID(clientID);
> Date creationTime = new Date();
> profileAlias.setCreationTime(creationTime);
> profileAlias.setModifiedTime(creationTime);
> persistenceService.save(profileAlias);
> } else if (!Objects.equals(profileAlias.getProfileID(), profileID)) {
> throw new IllegalArgumentException("Alias \"" + alias + "\" already used by profile with ID = \"" + profileID + "\"");
> }
> }
> {code}
> Also the error message is not correct, it should be:
> {code:java}
> throw new IllegalArgumentException("Alias \"" + alias + "\" already used by profile with ID = \"" + profileAlias.getProfileID() + "\"");
> {code}
> {color:#172b4d}*TODO:*{color}
> * {color:#172b4d}*remove the creation of alias on new profile, and only create aliases during the merge*{color}
> * {color:#172b4d}*Fix the error message to be more clear like mentioned.*{color}
> * {color:#172b4d}*Add missing integration test and/or provide better integration test regarding the alias + merge logic.*{color}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)