Fórum

How to get category from JournalArticle

Hugo Palma, modificado 14 Anos atrás.

How to get category from JournalArticle

New Member Postagens: 20 Data de Entrada: 13/09/07 Postagens Recentes
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, modificado 14 Anos atrás.

RE: How to get category from JournalArticle

Expert Postagens: 463 Data de Entrada: 23/03/09 Postagens Recentes
You should try this:
AssetCategoryServiceUtil.getCategories(JournalArticle.class.getName(), articleId);
Hugo Palma, modificado 14 Anos atrás.

RE: How to get category from JournalArticle

New Member Postagens: 20 Data de Entrada: 13/09/07 Postagens Recentes
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, modificado 14 Anos atrás.

RE: How to get category from JournalArticle

Expert Postagens: 463 Data de Entrada: 23/03/09 Postagens Recentes
I was checking that in the latest trunk, so I think it will be the future emoticon
liferay developer, modificado 14 Anos atrás.

RE: How to get category from JournalArticle

New Member Postagens: 12 Data de Entrada: 30/03/10 Postagens Recentes
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, modificado 14 Anos atrás.

RE: How to get category from JournalArticle

Regular Member Postagens: 245 Data de Entrada: 15/09/09 Postagens Recentes
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, modificado 11 Anos atrás.

RE: How to get category from JournalArticle

Junior Member Postagens: 30 Data de Entrada: 20/08/12 Postagens Recentes
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