Fórumok

How to get category from JournalArticle

Hugo Palma, módosítva 14 év-val korábban

How to get category from JournalArticle

New Member Bejegyzések: 20 Csatlakozás dátuma: 2007.09.13. Legújabb bejegyzések
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, módosítva 14 év-val korábban

RE: How to get category from JournalArticle

Expert Bejegyzések: 463 Csatlakozás dátuma: 2009.03.23. Legújabb bejegyzések
You should try this:
AssetCategoryServiceUtil.getCategories(JournalArticle.class.getName(), articleId);
Hugo Palma, módosítva 14 év-val korábban

RE: How to get category from JournalArticle

New Member Bejegyzések: 20 Csatlakozás dátuma: 2007.09.13. Legújabb bejegyzések
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, módosítva 14 év-val korábban

RE: How to get category from JournalArticle

Expert Bejegyzések: 463 Csatlakozás dátuma: 2009.03.23. Legújabb bejegyzések
I was checking that in the latest trunk, so I think it will be the future emoticon
liferay developer, módosítva 14 év-val korábban

RE: How to get category from JournalArticle

New Member Bejegyzések: 12 Csatlakozás dátuma: 2010.03.30. Legújabb bejegyzések
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, módosítva 14 év-val korábban

RE: How to get category from JournalArticle

Regular Member Bejegyzések: 245 Csatlakozás dátuma: 2009.09.15. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: How to get category from JournalArticle

Junior Member Bejegyzések: 30 Csatlakozás dátuma: 2012.08.20. Legújabb bejegyzések
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