4
votes

I'm using Liferay 5 and I developed a portlet that lists some articles (using the JournalArticle class). The problem is that I cannot get the article's category.

I know that it's possible with Liferay 6, but can I do this in version 5?

1
Out of interest, how do you do it on Liferay 6?Jonny

1 Answers

1
votes

Liferay 5.2:

String className = JournalArticle.class.getName();
long classPK = 12345l; // This is the id of your article
boolean folksonomy = false; // Use true for retrieving tags, false for retrieving categories
List<TagsEntry> categories = TagsEntryLocalServiceUtil.getEntries(className, classPK, false);

Liferay 6.0:

List<AssetCategory> categories = AssetCategoryLocalServiceUtil.getCategories(className, classPK);