掲示板

How to find asset category/vocabulary by name

11年前 に Samuli Saarinen によって更新されました。

How to find asset category/vocabulary by name

New Member 投稿: 16 参加年月日: 12/02/22 最新の投稿
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
thumbnail
11年前 に Harish Kumar によって更新されました。

RE: How to find asset category/vocabulary by name

Expert 投稿: 483 参加年月日: 10/07/31 最新の投稿
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.

o 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
11年前 に Samuli Saarinen によって更新されました。

RE: How to find asset category/vocabulary by name

New Member 投稿: 16 参加年月日: 12/02/22 最新の投稿
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