cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Simplest approach to restrict publication of Canonical Product

rahulverma94
Active Participant
0 Kudos
274

Hi Experts,

We are using CanonicalProductSales through SalesAreaCatalogMapping for publication of products to a mapped catalog version. However every time I do this a copy of product gets created in default catalog as well. What is the simplest approach to stop publication of the products(i.e CanonicalProduct) to default catalog? Note: I do not want to write a handler unless there are no other ways to meet this requirement.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rahul,

I wrote one publication handler and returned empty list for particular item. It worked for me. Attaching piece of code as well.

 public <T extends CanonicalItem> List<T> group(final T item, final TargetItemCreationContext context)
 {
     return Collections.emptyList();

 }

 public <T extends CanonicalItem> boolean isApplicable(final T item, final TargetItemCreationContext context)
 {
     return "BaseProduct".equals(context.getTargetItemTypeCode());
 }


Thanks, Sid

Answers (1)

Answers (1)

Slava
Product and Topic Expert
Product and Topic Expert
0 Kudos

Rahul,

here is what you can do:

  • try not to send those items to DataHub: if they never entered DataHub, they never will be published. So, check, if you filter them somehow out before they reach DataHub.

  • you can remove the item types from the target extension (that's if you own the extension and not using or extending a provided extension with type definitions). Or you can create your own extension with a different target system name and copy only those item type definitions, which you want to publish excluding all others. This way when data published to the old target system the products will be included; but when they're published to the new target system the products will be excluded. There is serious drawback to this approach - unpublished items will accumulate in DataHub, so you will have to exclude them from raw and canonical models as well; or exclude them from raw only; or customize the cleanup extension to remove unpublished items.

  • Last suggestion is most commonly used but least wanted by you. You could write publication grouping handler to exclude the items you don't want to publish. This approach is well supported and you don't need to worry about accumulation of unpublished items.

Hope this helps.