Foren
No. of comment for blog, Wiki and Document
Sadanand Ghadage, geändert vor 7 Jahren.
No. of comment for blog, Wiki and Document
New Member Beiträge: 23 Beitrittsdatum: 26.12.14 Neueste Beiträge
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
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
David H Nebinger, geändert vor 7 Jahren.
RE: No. of comment for blog, Wiki and Document
Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
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...
Nikhil Nishchal, geändert vor 7 Jahren.
RE: No. of comment for blog, Wiki and Document
Regular Member Beiträge: 177 Beitrittsdatum: 22.06.12 Neueste Beiträge
Hi,
By using classNameId and ClassPK you can find proper entity type count.
Thanks!
By using classNameId and ClassPK you can find proper entity type count.
Thanks!
Sadanand Ghadage, geändert vor 7 Jahren.
RE: No. of comment for blog, Wiki and Document
New Member Beiträge: 23 Beitrittsdatum: 26.12.14 Neueste BeiträgeNikhil 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
David H Nebinger, geändert vor 7 Jahren.
RE: No. of comment for blog, Wiki and Document
Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
There are no message board posts that will ever have the wiki class id.
You're missing the role the asset entry plays.
You're missing the role the asset entry plays.