Showing posts with label Liferay Tags. Show all posts
Showing posts with label Liferay Tags. Show all posts

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.