Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Christian Warmark
Add categories to a JournalArticle
October 30, 2012 8:19 AM
Answer

Christian Warmark

Rank: New Member

Posts: 6

Join Date: June 17, 2011

Recent Posts

Hello, I'am trying to programmatically add a category to an JournalArticle. I have no problem in retrieving the JournalArticle or the categories. I have also found out that the connection between them is made in the table "AssetEntries_AssetCategories" but I have not managed to find any method on how to write to that table.

If anyone have any suggestion, please let me now.
Thanks
Hansche Honk
RE: Add categories to a JournalArticle
March 14, 2013 9:24 AM
Answer

Hansche Honk

Rank: New Member

Posts: 3

Join Date: September 4, 2012

Recent Posts

Maybe this works:
JournalArticleLocalServiceUtil.updateAsset(userId, article, assetCategoryIds, assetTagNames)
Richard Oliver Legendi
RE: Add categories to a JournalArticle
July 12, 2013 5:05 AM
Answer

Richard Oliver Legendi

Rank: Junior Member

Posts: 35

Join Date: November 30, 2009

Recent Posts

I know this is a quite old thread but here's a solution for 6.1 I was able to come up with (it was kinda time consuming to figure it out):

http://xcafebabe.blogspot.hu/2013/07/liferay-adding-categories-to-journal.html

Hope it helps you guys!
Tonu Sri
RE: Add categories to a JournalArticle
July 12, 2013 7:24 AM
Answer

Tonu Sri

Rank: Regular Member

Posts: 195

Join Date: April 15, 2011

Recent Posts

Hi Christian,

If you are adding a new content, you can store categories using:

AssetEntryLocalServiceUtil.updateEntry()

and if you are updating existing record, you can use :

JournalArticleLocalServiceUtil.updateAsset(userId, article, assetCategoryIds, assetTagNames)

Thanks:
Tonu
Irune Ne
RE: Add categories to a JournalArticle
August 6, 2013 3:40 AM
Answer

Irune Ne

Rank: New Member

Posts: 1

Join Date: May 4, 2011

Recent Posts

Thx @Richard, been like 2 hours trying this through the JournalArticleLocalServiceUtil. to no avail (lr 6.1)
AssetEntryLocalServiceUtil.updateEntry worked nicely