Highlighted

Extending the Community Groups Component

monikaa6

27-02-2018

Hi All,

We are using AEM 6.2, Communities FP3, SP1.

I am trying to extend the back-end of Community Groups component.

I have already extended the following component in the /apps side

/libs/social/group/components/hbs/communitygroups

/libs/social/group/components/hbs/communitygroups/communitygroup

But, Now

1. I need to add few additional properties in the JSON Response of a component.

/libs/social/group/components/hbs/communitygroups/communitygroup

    • Return Tags and some other custom additional properties
    • Change the defaultImage Path defined in the “CommunityGroupImpl”

          this.imageURL = ((groupImage == null)

? this.clientUtils.externalLink("/etc/clientlibs/social/hbs/communitygroups/images/default.png"

As per the documentation If we need to change the JSON Response of the Component

https://helpx.adobe.com/experience-manager/6-2/communities/using/scf.html

Extend the Abstract Class and Implement the corresponding interfaces to extend

I don’t find any Abstract class for this component In API

https://helpx.adobe.com/experience-manager/6-2/sites/developing/using/reference-materials/javadoc/co...

Also, If I just try to implement the

Public Class CustomCommunityGroup implements CommunityGroup {

…}

It gives me the error

The type com.adobe.cq.social.site.api.BaseSite cannot be resolved. It is indirectly referenced from required .class files”

  2. And In the below component

         /libs/social/group/components/hbs/communitygroups

  • Need to change the defaultImage property

For this also I could not find any Abstract class in the documentation to Extend

https://helpx.adobe.com/experience-manager/6-2/sites/developing/using/reference-materials/javadoc/co...

There is only one interface available

  1. com.adobe.cq.social.group.client.api.CommunityGroupCollection

which asks you to override almost all the methods.

But I want whatever is OOB available and add some additional attributes and change few of them

Reference JSON response of we-retail website which I want to change

/content/we-retail/community/en/groups/jcr:content/content/primary/communitygroups.social.json

Please let me know if anyone already has done something like that, any help is much appreciated.

Thanks,

Monika

Replies

Highlighted

apanghal

Employee

05-03-2018

Hi

Could you please look at the PostOperation extension option to add additional properties when you create your group and all properties should be available in json at the time of retrieval.

One sample can be seen here - aem-scf-sample-components-extension/IdeationStatusExtension.java at master · Adobe-Marketing-Cloud/a...

for extension , look at the interface - CommunityGroupOperationExtension ("The Adobe AEM Quickstart and Web Application.")

-Ashok

Highlighted

monikaa6

06-03-2018

Thanks ashokkumar, I was able to add any new custom property, when we create a group and that gets available at time of retrieval in json.

But I have requirement to Add few more things to display in the Community Groups components which needs to be dynamically generated when component is getting rendered(For e.g, count of members in the community).

How should I make such changes and return in the JSON response of a component?

Thanks,

Monika

Highlighted

monikaa6

08-03-2018

ashokkumar​ - Any pointers for my above question.

I want to add some dynamic values in the JSON response, the properties added at the time of creation/updation of group changes only when you update/create group.

But for e.g. Member counts keeps on changing and I want to display that as well in community groups component, logic for that can only be calculated during rendering of a component.

Also, I want the feature of searching the groups based on other custom property,and sorting the collection of items.

If abstract classes to Extend the backend of these components (for e.g we have Abstract classes for Comments "AbstractCommentCollection" and for Activity "AbstractActivity")  available then it would be more easy.

Appreciate all your help!

Thanks,

Monika

Highlighted

monikaa6

15-08-2018

For others reference, we ended up adding the Custom properties while creating the community Group by extending the com.adobe.cq.social.group.client.endpoints.CommunityGroupOperationExtension.

And to update the value of dynamic values, we wrote custom back end schedulers jobs