留言板

No. of comment for blog, Wiki and Document

thumbnail
Sadanand Ghadage,修改在7 年前。

No. of comment for blog, Wiki and Document

New Member 帖子: 23 加入日期: 14-12-26 最近的帖子
Hi People,

I have a requirement where I have to count the number of comments available for each Blog, Wiki Page and Document. How we can achieve this ?
any inputs ?

Regards,
Sadanand
thumbnail
David H Nebinger,修改在7 年前。

RE: No. of comment for blog, Wiki and Document

Liferay Legend 帖子: 14916 加入日期: 06-9-2 最近的帖子
Generally, comments are tied to the assets, not the individual entities. But I don't believe there is a general sort of query that is going to return a list of assets w/ comment counts...
thumbnail
Nikhil Nishchal,修改在7 年前。

RE: No. of comment for blog, Wiki and Document

Regular Member 帖子: 176 加入日期: 12-6-22 最近的帖子
Hi,
By using classNameId and ClassPK you can find proper entity type count.

Thanks!
thumbnail
Sadanand Ghadage,修改在7 年前。

RE: No. of comment for blog, Wiki and Document

New Member 帖子: 23 加入日期: 14-12-26 最近的帖子
Nikhil Nishchal:
Hi,
By using classNameId and ClassPK you can find proper entity type count.

Thanks!


Thanks Nikhil,

This solution is working fine for the Blog and Documents. But for Wiki page it is not showing any comment. Here is my code

DynamicQuery mbMessageQuery = DynamicQueryFactoryUtil.forClass(MBMessage.class, PortalClassLoaderUtil.getClassLoader());
					long WikiNodeClassNameId = ClassNameLocalServiceUtil.getClassNameId(WikiPage.class.getName());
					mbMessageQuery.add(RestrictionsFactoryUtil.eq("classNameId", WikiNodeClassNameId));
					mbMessageQuery.add(PropertyFactoryUtil.forName("parentMessageId").ne(0l));
					mbMessageQuery.add(PropertyFactoryUtil.forName("classNameId").ne(0l));
					mbMessageQuery.add(PropertyFactoryUtil.forName("classPK").eq(tempPage.getPageId()));
					mbMessageQuery.add(PropertyFactoryUtil.forName("categoryId").eq(-1l));

					List dynamicQuery = MBMessageLocalServiceUtil.dynamicQuery(mbMessageQuery);

Can you please correct me, if I am doing wrong..

Regards,
Sadanand
thumbnail
David H Nebinger,修改在7 年前。

RE: No. of comment for blog, Wiki and Document

Liferay Legend 帖子: 14916 加入日期: 06-9-2 最近的帖子
There are no message board posts that will ever have the wiki class id.

You're missing the role the asset entry plays.