Foros de discusión

No. of comment for blog, Wiki and Document

thumbnail
Sadanand Ghadage, modificado hace 7 años.

No. of comment for blog, Wiki and Document

New Member Mensajes: 23 Fecha de incorporación: 26/12/14 Mensajes recientes
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 hace 7 años.

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

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
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 hace 7 años.

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

Regular Member Mensajes: 177 Fecha de incorporación: 22/06/12 Mensajes recientes
Hi,
By using classNameId and ClassPK you can find proper entity type count.

Thanks!
thumbnail
Sadanand Ghadage, modificado hace 7 años.

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

New Member Mensajes: 23 Fecha de incorporación: 26/12/14 Mensajes recientes
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 hace 7 años.

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

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
There are no message board posts that will ever have the wiki class id.

You're missing the role the asset entry plays.