Combination View Flat View Tree View
Threads [ Previous | Next ]
Gwowen Fu
Help with adding Related Asset to web content?
April 25, 2013 2:40 PM

Gwowen Fu

Rank: Expert

Posts: 315

Join Date: December 27, 2010

Recent Posts

Is this the right direction to add related asset (Bookmark) to web content?
1          AssetEntry assetEntry = AssetEntryLocalServiceUtil.createAssetEntry(getNextPK());
2          assetEntry.setClassPK(currentArticle.getClassPK());
3          AssetEntryLocalServiceUtil.addAssetEntry(assetEntry);
4          AssetLink assetLink = AssetLinkLocalServiceUtil.createAssetLink(getNextPK());
5          assetLink.setEntryId1(assetEntry.getEntryId());
6          assetLink.setEntryId2(bookmarkEntryID);
7          AssetLinkLocalServiceUtil.addAssetLink(assetLink);

Is there an better way, looks like this could be done in one call? Something like article.setRelatedAsset(bookmarkID).

Any help is appreciated!!!