Introduction

The module’s integration lets you add social functionality to your website:

  • it gives you APIs to detect the social interactions of the customer on different social websites;

  • you can use this API to build your services, such as to allow customers' social login, or to track your customers, for example;

Business

Development

Core

Entity Definitions

The definitions in this module have id discriminators in the range 280-290.

SocialPreferenceFilterEntityDefinition

The SocialPreferenceFilterEntityDefinition extends the AbstractFilterEntityDefinition, going further to the AbstractEntityDefinition:

asciidoctor diagram SocialPreferenceFilterEntityDefinition

The inherited abstract classes are extended with one property here - socialPreference. It stores the social preference (an instance of SocialPreferenceEntityDefinition) the user must have in order the filter to be triggered.

SocialConnectionEntityDefinition

The SocialConnectionEntityDefinition adds the social connection-related attributes to the AbstractEntityDefinition and the AbstractUserableEntityDefinition:

asciidoctor diagram SocialConnectionEntityDefinition

Via the respective getter-setter pairs, the following information can be retrieved/stored in the database:

Property Description

providerId

stores the id of the provider of the social connection

providerUserId

stores the user id of the social connection’s provider

rank

stores the rank of the social connection

displayName

stores the human readable display name of the social connection

profileUrl

stores the profile url of the user with the social connection

imageUrl

stores the url of the user’s image

accessToken

stores the access token for the social connection

secret

stores the secret of the social connection

refreshToken

stores the refresh token of the social connection

expireTime

stores the expiry time of the social connection

SocialCustomerEntityDefinition

The SocialCustomerEntityDefinition adds the social-related attributes to the CustomerEntityDefinition. The inheritance goes further to the UserEntityDefinition, the PrincipalEntityDefinition and the AbstractEntityDefinition:

asciidoctor diagram SocialCustomerEntityDefinition

Via the respective getter-setter pairs, the following information can be retrieved/stored in the database:

Property Description

socialConnections

stores a set of the user’s social connections

socialPreferences

stores a set of the user’s social preferences (brands, pages, accounts, etc)

SocialEmployeeEntityDefinition

The SocialEmployeeEntityDefinition adds the social-related attributes to the EmployeeEntityDefinition. The inheritance goes further to the UserEntityDefinition, the PrincipalEntityDefinition and the AbstractEntityDefinition:

asciidoctor diagram SocialEmployeeEntityDefinition

The inherited abstract classes are extended with one property here - twitterAccount. It stores the user’s twitter account.

SocialPreferenceEntityDefinition

The SocialPreferenceEntityDefinition extends the AbstractEntityDefinition:

asciidoctor diagram SocialPreferenceEntityDefinition

Via the respective getter-setter pairs, the following information can be retrieved/stored in the database:

Property Description

name

stores the name of the social preference

twitterId

stores the twitter id of the social preference

facebookId

stores the facebook id of the social preference

SocialSiteEntityDefinition

The SocialSiteEntityDefinition adds the social-related attributes to the SiteEntityDefinition. The inheritance goes further to the AbstractEntityDefinition and the AbstractDescriptionableEntityDefinition:

asciidoctor diagram SocialSiteEntityDefinition

The added here property is twitterAccount. It’s designed to store the twitter account of the website.

Spring Data JPA Repositories

SocialPreferenceFilterRepository

The SocialPreferenceFilterRepository extends the BaseEntityRepository and is the corresponding Spring Data JPA repository for the SocialPreferenceFilterEntityDefinition:

asciidoctor diagram SocialPreferenceFilterRepository
SocialConnectionRepository

The SocialConnectionRepository extends the BaseEntityRepository and is the corresponding Spring Data JPA repository for the SocialConnectionEntityDefinition:

asciidoctor diagram SocialConnectionRepository
SocialPreferenceRepository

The SocialPreferenceRepository extends the BaseEntityRepository and is the corresponding Spring Data JPA repository for the SocialPreferenceEntityDefinition:

asciidoctor diagram SocialPreferenceRepository

Business Services

SocialConnectionServiceImpl

The SocialConnectionServiceImpl implements the Spring social ConnectionRepository

UserSocialConnectionServiceImpl

The UserSocialConnectionServiceImpl implements the Spring social UsersConnectionRepository

Social Login sample implementation

A sample implementation of the social login is already implemented on the B2C Samplestore website. You need to add the social module to your classpath, then add the following social login buttons:

<div class="social">
    <h3><spring:message code="login.social"/>: </h3>
    <form:form name="fb_signin" id="fb_signin" action="signin/facebook" method="POST" servletRelativeAction="true">
        <button type="submit" class="fb"><spring:message code="login.social.facebook"/></button>
        <input type="hidden" name="scope" value="public_profile,email,user_likes" />
        <sec:csrfInput/>
    </form:form>
    <form:form name="tw_signin" id="tw_signin" action="signin/twitter" method="POST" servletRelativeAction="true">
        <button type="submit" class="tw"><spring:message code="login.social.twitter"/></button>
        <input type="hidden" name="scope" value="public_profile,email,publish_stream,offline_access,user_likes" />
        <sec:csrfInput/>
    </form:form>
</div>

The first button will submit a form that will redirect you to a signin/facebook controller which will initiate the OAuth dance. The second one will do the same but for twitter.

Configuration

Name Type Description

nemesis.social.avatar-provider-order

java.lang.Integer

The order of the avatar provider.

nemesis.social.connect-controller-redirect-path

java.lang.String

The path to where the connect controller must redirect after successful connect/disconnect.

nemesis.social.connect-controller-view-path

java.lang.String

The path to the views that are used by the {@code ConnectController}.

nemesis.social.password

java.lang.String

The password for the social encryption.

nemesis.social.post-sign-in-url

java.lang.String

The post sign-in url for the {@code ProviderSignInController}.

nemesis.social.salt

java.lang.String

The salt for the social encryption.

nemesis.social.sign-in-url

java.lang.String

The sign-in url for the {@code ProviderSignInController}.

nemesis.social.sign-up-url

java.lang.String

The sign-up url for the {@code ProviderSignInController}.

nemesis.social.social-avatar-height

java.lang.Integer

The height of the social avatar.

nemesis.social.social-avatar-width

java.lang.Integer

The width of the social avatar.

nemesis.social.social-preferences-cron-trigger

java.lang.String

Cron trigger for running the social preferences job. Defaults to once per day at midnight.