16 May, 2011

Find Blogs By Tag Name

Hi Everyone,

If you want to find blogs as per the tag name in Liferay 6 the code is here :
public List findBlogsByTagName(String[] tagNames){
long[] anyTagIds = AssetTagLocalServiceUtil.getTagIds(themeDisplay.getScopeGroupId(),tagNames);


AssetEntryQuery assetEntryQuery = new AssetEntryQuery();
assetEntryQuery.setAnyTagIds(anyTagIds);
List assetEntryList = AssetEntryLocalServiceUtil.getEntries(assetEntryQuery);
List blogList =new ArrayList();
try{
for(AssetEntry ae : assetEntryList)
{
BlogsEntry blogEntryObj = BlogsEntryLocalServiceUtil.getBlogsEntry(ae.getClassPK());
blogList.add(blogEntryObj);
}
}catch(Exception e){
e.printStackTrace();
}
return blogList;
}

Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...