Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Gwowen Fu
Check if journal article has certain tag?
December 31, 2012 8:39 AM
Answer

Gwowen Fu

Rank: Expert

Posts: 277

Join Date: December 27, 2010

Recent Posts

Hi,

What's the easiest way to check if an article has a certain tag?

What I can think of now is to use AssetTagLocalServiceUtil.dynamicQuery(dynamicQuery) and the dynamicQuery involves few tables.

I wish there is a method like article.hasTag(tagName) exists.

Thanks!
Gwowen
Jelmer Kuperus
RE: Check if journal article has certain tag?
December 31, 2012 9:16 AM
Answer

Jelmer Kuperus

Rank: Liferay Legend

Posts: 1192

Join Date: March 10, 2010

Recent Posts

1Arrays.asList(AssetEntryLocalServiceUtil.getEntry(JournalArticle.class.getName(), id).getTagNames()).contains(yourTag);
Gwowen Fu
RE: Check if journal article has certain tag?
December 31, 2012 12:39 PM
Answer

Gwowen Fu

Rank: Expert

Posts: 277

Join Date: December 27, 2010

Recent Posts

jelmer kuperus:
1Arrays.asList(AssetEntryLocalServiceUtil.getEntry(JournalArticle.class.getName(), id).getTagNames()).contains(yourTag);


Thanks, this is indeed easier.