Saturday, April 9, 2011

Display Journal Articles based on Tags

1. Have a long[] array containing Tag Ids for which you want to serach Journal Articles

long[] tagIds = {tagId1,tagId2,…..};

2. Create an AssetEntryQuery and set the tagIds as the criteria

AssetEntryQuery assetEntryQuery = new AssetEntryQuery();
assetEntryQuery.setAllTagIds(tagIds);

3. Call the getEntries(AssetEntryQuery ob) method on AssetEntryLocalServiceUtil class to get the list of assetEntries

ListentryList = new ArrayList();
try {
entryList = AssetEntryLocalServiceUtil.getEntries(assetEntryQuery);
} catch (SystemException e) {
e.printStackTrace();
}

4. Now iterate the list and pick classPK attribute for each entry and from that query JournalArticle Table for corresponding articleId.

2 comments:

  1. When will you post again ? Been looking forward to this !

    ReplyDelete
  2. Really interesting blog, keep up the good work!

    ReplyDelete