如何在HYBRIS中使用Impex从集合中删除值?

时间:2019-02-17 11:58:42

标签: hybris impex

我正在尝试扩展OOTB Impex,以从 customersupportmanagergroup 中删除 customersupportagentrole ,但它不起作用。请帮忙。

这是OOB Impex。

INSERT_UPDATE CsAgentGroup;UID[unique=true];locname[lang=en];groups(uid)[mode=append];description
;customersupportmanagergroup;Customer Support Manager Group;customersupportmanagerrole,customersupportagentrole,csagentgroup,csagentmanagergroup;The Customer Support Manager Group has access to the Customer Support Backoffice's Customer Support Manager Group and Customer Support Agent Group views AND/OR the Assisted Service Module.
;customersupportagentgroup;Customer Support Agent Group;customersupportagentrole,csagentgroup;The Customer Support Agent Group has access to the Customer Support Backoffice's Customer Support Agent Group views and AND/OR the Assisted Service Module.

这是我的Impex,用于从客户支持经理组中删除 customersupportagentrole

INSERT_UPDATE CsAgentGroup;UID[unique=true];locname[lang=en];groups(uid)[mode=append];description
;customersupportmanagergroup;Customer Support Manager Group;customersupportmanagerrole,csagentgroup,csagentmanagergroup;The Customer Support Manager Group has access to the Customer Support Backoffice's Customer Support Manager Group and Customer Support Agent Group views AND/OR the Assisted Service Module.
;customersupportagentgroup;Customer Support Agent Group;customersupportagentrole,csagentgroup;The Customer Support Agent Group has access to the Customer Support Backoffice's Customer Support Agent Group views and AND/OR the Assisted Service Module.

4 个答案:

答案 0 :(得分:3)

您使用的是 public ActionResult UpdateChart() { Random random = new Random(); PartialViewResult partialViewResult = PartialView("~/Views/Shared/chartPartialView.cshtml", new ChartModel() { CategoriesStackBar = new List<string>() { "A", "B", "C" }, Series = new List<Series>() { new ColumnSeries() { Name = "A", Data = new List<ColumnSeriesData>() { new ColumnSeriesData() { Y = random.Next(100), }, new ColumnSeriesData() { Y = random.Next(100), }, new ColumnSeriesData() { Y = random.Next(100), }, }, Id = "dynamicChart", } } }); return partialViewResult; } ,它基本上将您的值附加到现有集合(组)中。对于您而言,在执行Impex之前,某些Impex(OOTB)可能已经向mode=append添加了customersupportagentrole。现在,您的Impex不会覆盖现有值,而只是附加值。因此,请尝试使用 customersupportmanagergroup ,它基本上会覆盖现有值。

mode=replace

答案 1 :(得分:2)

您需要删除Impex中的现有项目。

下面的代码删除CsAgentGroup项(感谢@FarrukChishti的注意)

REMOVE CsAgentGroup;UID[unique=true];groups(uid)
;customersupportmanagergroup;customersupportagentrole

我们只需要删除关系,就可以像下面这样从关系类型中删除项目,或者像其他答案一样更新现有的项目。

REMOVE PrincipalGroupRelation;source[unique=true](uid);target[unique=true](uid)
;customersupportmanagergroup;customersupportagentrole

答案 2 :(得分:1)

您可以这样操作,如果您不分组使用模式运算符,它将用您指定的组件替换集合

INSERT_UPDATE CsAgentGroup; UID [unique = true];组(uid);;客户支持经理组; csagentgroup,csagentmanagergroup;

或者如果您将[mode = remove]放进去,它将删除您指定的组件

INSERT_UPDATE CsAgentGroup; UID [unique = true]; groups(uid)[mode = remove] ;;客户支持经理小组;客户支持经理角色;

答案 3 :(得分:0)

您要更新 customersupportmanagergroup ,以便在期间删除将 customersupportmanagergroup 连接到 customersupportagentrole 的任何链接。 > customersupportagentrole 仍存在于数据库中。 使用删除查询将从数据库中删除 customersupportagentrole

UPDATE CsAgentGroup;UID[unique=true];groups(uid)
;customersupportmanagergroup;customersupportmanagerrole,csagentgroup,csagentmanagergroup