Foren

How to get category from JournalArticle

Hugo Palma, geändert vor 14 Jahren.

How to get category from JournalArticle

New Member Beiträge: 20 Beitrittsdatum: 13.09.07 Neueste Beiträge
Hi everyone,
i have a JournalArticle and i would like to know which category it belongs to, but i can't find anything in the JournalArticle or any other class that would let me find it.

Any ideas ?
Thanks.
thumbnail
Zsolt Balogh, geändert vor 14 Jahren.

RE: How to get category from JournalArticle

Expert Beiträge: 463 Beitrittsdatum: 23.03.09 Neueste Beiträge
You should try this:
AssetCategoryServiceUtil.getCategories(JournalArticle.class.getName(), articleId);
Hugo Palma, geändert vor 14 Jahren.

RE: How to get category from JournalArticle

New Member Beiträge: 20 Beitrittsdatum: 13.09.07 Neueste Beiträge
Zsolt Balogh:
You should try this:
AssetCategoryServiceUtil.getCategories(JournalArticle.class.getName(), articleId);


Thanks, your reply lead me to TagsAssetServiceUtil which does the job. It seems AssetCategoryServiceUtil doesn't exist anymore.
thumbnail
Zsolt Balogh, geändert vor 14 Jahren.

RE: How to get category from JournalArticle

Expert Beiträge: 463 Beitrittsdatum: 23.03.09 Neueste Beiträge
I was checking that in the latest trunk, so I think it will be the future emoticon
liferay developer, geändert vor 14 Jahren.

RE: How to get category from JournalArticle

New Member Beiträge: 12 Beitrittsdatum: 30.03.10 Neueste Beiträge
Hi there,

can you explain how to get category from JournalAricle IN THE PRESENT?

I am extending journal articles portlet and I need to filter by category.

Thanks
Roberto Tellado, geändert vor 14 Jahren.

RE: How to get category from JournalArticle

Regular Member Beiträge: 245 Beitrittsdatum: 15.09.09 Neueste Beiträge
Hello,

In the version 6, you can filter by category in the asset publisher. You can view the code, and implement it in your code.

Sorry for my english.

Regards.
Edouard Perr, geändert vor 11 Jahren.

RE: How to get category from JournalArticle

Junior Member Beiträge: 30 Beitrittsdatum: 20.08.12 Neueste Beiträge
Hello,

Because it is the first result in Google concerning this question, I add the way to retrieve journal article categories (and tags).

Zsolt Balogh said :
AssetCategoryServiceUtil.getCategories(JournalArticle.class.getName(), articleId);


I tried with : ja.getId() / ja.getArticleId() / ja.getPrimaryKey() None of these worked.

Actually you need this :
List<assetcategory> categories = AssetCategoryLocalServiceUtil.getCategories(JournalArticle.class.getName(), ja.getResourcePrimKey());
List<assettag> tags = AssetTagLocalServiceUtil.getTags(JournalArticle.class.getName(), ja.getResourcePrimKey());</assettag></assetcategory>


It can be useful for new comers.
I found it in the post here, which is not well-referenced by google compared to this one.

Regards.
Edouard