Favorites / Social Approaches

AEM Communities

  • "Voting" Component has similar behavior as favorites. So we can use that component.
  • We can create users using:

curl '.../primary/signup.social.json' -uadmin:admin -v -X POST -H "Accept:application/json" --data 'email=user1@gmail.com&password=123456&:operation=social:createTenantUser' --compressed

AEM Communities

  • We can set a favorite page adding the component "voting" to a landing page, then:

curl http://localhost:4502/content/kids/en/myhome/jcr:content/parsys/voting -uuser1@gmail.com:123456 -v -X POST -H "Accept:application/json" --data ":operation=social:samples:toggleFavorite"

*toggleFavorite is a custom method in new Favorites Bundle.

AEM Communities

  • Good:
    • Integrated with Adobe Social Common Store (Cloud) / Mongo + Solr.
    • Votes component has similar behavior.
    • We can use all the AEM Community features (https://docs.adobe.com/docs/en/aem/6-1/administer/communities/overview.html)

AEM Communities

  • Bad:
    • Duplicated users (Up to 50 millions)

Custom REST API

We can create a custom API using one of REST HATEOAS frameworks in java like Spring HATEOAS + Spring Boot and manage data in a separated MongoDB (other database for big collections).

 

Custom REST API

Create Users:

curl -i -X POST -H "Content-Type:application/json" -d '{ "username" : "user1", "email" : "jhelbert@gmail.com", "favorites": [{"cardId": "/content/kids/en/myhome"}]}' http://localhost:9090/users

Edit an user (adding a new favorite):

curl -i -X PUT -H "Content-Type:application/json" -d '{ "favorites": [{"cardId": "/content/kids/en/games/wow"}]}' http://localhost:9090/users/56b43f3dd4c608c967315913

Custom REST API

Create Favorites:

curl -i -X POST -H "Content-Type:application/json" -d '{ "cardId" : "/content/kids/en/myhome", "users": [{"id":"56b43f3dd4c608c967315913"}]}' http://localhost:9090/cards

SOLR Collection

We can use SOLR as data repository for "social" collections like 'users' (with profile, preferences, etc) and 'favorites'.

I tried to find a similar approach as this one for Favorites but I just found mixed approaches (MongoDB + SOLR) 

deck

By Helbert Rico

deck

  • 566