Fórum

No. of comment for blog, Wiki and Document

thumbnail
Sadanand Ghadage, modificado 7 Anos atrás.

No. of comment for blog, Wiki and Document

New Member Postagens: 23 Data de Entrada: 26/12/14 Postagens Recentes
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, modificado 7 Anos atrás.

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

Liferay Legend Postagens: 14917 Data de Entrada: 02/09/06 Postagens Recentes
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, modificado 7 Anos atrás.

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

Regular Member Postagens: 177 Data de Entrada: 22/06/12 Postagens Recentes
Hi,
By using classNameId and ClassPK you can find proper entity type count.

Thanks!
thumbnail
Sadanand Ghadage, modificado 7 Anos atrás.

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

New Member Postagens: 23 Data de Entrada: 26/12/14 Postagens Recentes
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, modificado 7 Anos atrás.

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

Liferay Legend Postagens: 14917 Data de Entrada: 02/09/06 Postagens Recentes
There are no message board posts that will ever have the wiki class id.

You're missing the role the asset entry plays.