Jeffrey P.
Jeffrey P.

Reputation: 41

Getting the Article's Category in Liferay 5

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?

Upvotes: 4

Views: 2144

Answers (1)

p.mesotten
p.mesotten

Reputation: 1402

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);

Upvotes: 1

Related Questions