Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Samuli Saarinen
How to find asset category/vocabulary by name
September 28, 2012 1:36 AM
Answer

Samuli Saarinen

Rank: New Member

Posts: 12

Join Date: February 21, 2012

Recent Posts

Hi,

I have a portlet that creates some vocabularies/categories automatically on startup. After server restart / redeployment I would like to see if these categories still exists but this proves to be some what difficult. Categories have a name that I could use for lookup but name is derived from the title in default locale. So this lookup would fail as soon as some goes and changes the title. I really can't see the reasoning behind this design as it makes dealing with Categories via the Liferay API messy. It would be better if the API allowed giving the name explicitly and used the title only if name is not specified.

Has somebody stumbled this before and is there some kind of workaround or something I have overlooked?

Thanks,

Samuli
Harish Kumar
RE: How to find asset category/vocabulary by name
September 28, 2012 2:54 AM
Answer

Harish Kumar

Rank: Expert

Posts: 327

Join Date: July 31, 2010

Recent Posts

Hi Samuli,

This change has been added to support multiple language support.

As far as look up is concerned finder methods are available there with name and vocabularyId/parentCategoryId.

1o this lookup would fail as soon as some goes and changes the title.


There is no such way available to change the title directly, So as long as you won't change the name from control panel, It will work fine as expected.

HTH
Regards
Samuli Saarinen
RE: How to find asset category/vocabulary by name
October 5, 2012 1:53 AM
Answer

Samuli Saarinen

Rank: New Member

Posts: 12

Join Date: February 21, 2012

Recent Posts

Thanks for the suggestion.

I ended up doing it using AssetCategoryProperties and giving each category a property "name"="nameForLookup" and use that foor looking up the right category. This does not work for vocabularies so there I have to rely on nobody changing the vocabulary name.

BR,
Samuli