Tuesday, December 22, 2015

Resolving missing dimension relationship

In one of my previous project on Oracle WCS 11g 8, I faced several times the problem of missing translation among master and translated assets for many assets after using Realtime Publishing. No matter how tedious or careful I was to publish first only master assets and then publish other translated assets, either due to dependency not all master assets were published or somehow did not published the translation link between master and translated asset. In such scenario, there is no other option than to write a simple utility to create a dimension relationship link between them again.

Steps to resolve this issue is:
  1. Find the assets which are missing this translation link among assets. In order to do that, compare the <AssetType>_DimP tables between source and destination instances after running the following query using Support Tools or using some utility element:
    Select CS_OWNERID, CS_DIMENSIONPARENTID from <AssetType>_DimP where CS_OWNERID!=CS_DIMENSIONPARENTID
  2. Important columns are CS_OWNERID (translated assetid) and CS_DIMENSIONPARENTID (master assetid)
  3. List down the assets which are not present on your destination instance by comparing. I prefer the following final format to update dimension relationship for multiple assets of a particular assettype: <TranslatedId1>,<MasterId1>;<TranslatedId2>,<MasterId2>... 
Once you have the above string, create one template (applies to various assettypes, can be called externally from browser or as layout) and add the following code:

Hit the url: [hostname]:[port]/[sites context]/ContentServer?pagename=[Sitename where template was created]/[YourTemplateName]&assetType=[AssetType] 
for e.g. http://localhost:9080/cs/ContentServer?pagename=FirstSiteII/ResolveMissingTranslations&assetType=Product_C
and wait for the output.

Sometimes, even after running the above code may not update all assets because there can be 2 translated assets supposed to be associated to same master asset and <asset:save> tag will not able to save the asset for both in same request. So, just run the utility again for the failed ones and that should resolve the issue. Compare again by running the same above query and the result should be same. Check in contributor UI to cross-check if dimension relationship was generated or not.

NOTE: You have to run this utility for all the affected assets of different assets types separately.
 
Disclaimer: Any sample code on this blog is not officially recommended, use at your own risk.

No comments:

Post a Comment

A simple code compare functionality

One of the most important aspect of any development cycle is deployment and while deployment, it is very important to note the changes don...