留言板

Get Users with Specific Vocabulary and Category

Becas Kostas,修改在11 年前。

Get Users with Specific Vocabulary and Category

Junior Member 帖子: 28 加入日期: 12-8-30 最近的帖子
Hey,

I am trying to get all the users that match a specific category in my custom portlet. My implementation till now, is to iterate through the users, get the categories of the user and check if it is matching my filter.

List<user> us = new ArrayList<user>();
	for (User u:users){
		
		List<assetcategory> catu = AssetCategoryLocalServiceUtil.getCategories("com.liferay.portal.model.User",u.getUserId());
		if (catu.contains(cat)){
			us.add(u);
		}
	}
</assetcategory></user></user>


Is there any other method? For example i have tried to create an asset entry query for the users with no success.


AssetEntryQuery aeq = new AssetEntryQuery();
aeq.setClassName("com.portal.model.User");
aeq.setAnyCategoryIds(new long[]{Long.parseLong(categorization)});

List<assetentry> assets = AssetEntryServiceUtil.getEntries(aeq);
</assetentry>


The above always returns an empty list.
Sanketh Iyer,修改在9 年前。

RE: Get Users with Specific Vocabulary and Category

Junior Member 帖子: 25 加入日期: 12-2-2 最近的帖子
Hi Becas,

I have a similar requirement.
Did you find any solution?

Thanks,
Sanketh