3.2.1. Social

There are the following components in Social that can be overridden:

Relationship listener plugin

RelationshipListenerPlugin enables you to listen to events of a relationship between users. By implementing this overriable component, users will be notified when the connection request is accepted or the connection is removed.

To use the RelationshipListenerPlugin class, you can do as follows:

  1. Create a new class, for example, RelationshipPublisher that extends RelationshipListenerPlugin.

    public class RelationshipPublisher extends RelationshipListenerPlugin {
    
            ...
            }
          
  2. Override functions in this created class. In each function, you can write anything to meet your needs.

    public void confirmed(RelationshipEvent event);
    
            public void removed(RelationshipEvent event);
          
    • The confirmed function is called when a connection request is accepted.

    • The removed function is called when a connection is removed.

  3. Add a new configuration to the /social-config/src/main/resources/conf/social/core-configuration.xml file with the type that is the class created in Step 1.

    
    <sscomponent>
      <key>org.exoplatform.social.core.application.RelationshipPublisher</key>
      <type>org.exoplatform.social.core.application.RelationshipPublisher</type>
    </component>

Profile listener plugin

ProfileListenerPlugin enables you to listen to events of profiles of users. By implementing this overriable component, a notification will be updated in Activity Stream when the profile is changed.

To use the ProfileListenerPlugin class, you can do as follows:

  1. Create a new class, for example, ProfileUpdatesPublisher that extends ProfileListenerPlugin.

    public class ProfileUpdatesPublisher extends ProfileListenerPlugin {
    
            .....
            }
          
  2. Override functions in this created class. In each function, you can write anything to meet your needs.

    /**
    
            * avatar picture of the profile is updated
            * @param event
            */
            public void avatarUpdated(ProfileLifeCycleEvent event) ;
            /**
            * basic account info of the profile are updated
            * @param event
            */
            public void basicInfoUpdated(ProfileLifeCycleEvent event);
            /**
            * contact information of the profile is updated
            * @param event
            */
            public void contactSectionUpdated(ProfileLifeCycleEvent event) ;
            /**
            * experience section of the profile is updated
            * @param event
            */
            public void experienceSectionUpdated(ProfileLifeCycleEvent event);
            /**
            * header section of the profile is updated
            * @param event
            */
            public void headerSectionUpdated(ProfileLifeCycleEvent event) ;
    • The avatarUpdated function is called when the avatar picture of a user is updated.

    • The basicInfoUpdated function is called when the basic account information of a user is updated.

    • The contactSectionUpdated function is called when the contact information of a user is updated.

    • The experienceSectionUpdated function is called when the experience section of a user is updated.

    • The headerSectionUpdated function is called when the header section of a user is updated.

  3. Add a new configuration to the /social-config/src/main/resources/conf/social/core-configuration.xml file with the type that is the class created in Step 1.

    
    <component>
      <key>org.exoplatform.social.core.application.ProfileUpdatesPublisher</key>
      <type>org.exoplatform.social.core.application.ProfileUpdatesPublisher</type>
    </component>

Space listener Plugin

SpaceListenerPlugin enables you to listen to events of spaces. By implementing this overriable component, the notification will be updated in Activity Stream of the space or of members when the space information is changed or when a user joins or leaves the space.

To use the SpaceListenerPlugin class, you can do as follows:

  1. Create a new class, for example, SpaceActivityPublisher that extends SpaceListenerPlugin.

    public class SpaceActivityPublisher extends SpaceListenerPlugin {
    
            {
          
  2. Override functions in this created class. In each function, you can write anything to meet your needs.

    public void spaceCreated(SpaceLifeCycleEvent event);
    
            public void grantedLead(SpaceLifeCycleEvent event);
            public void revokedLead(SpaceLifeCycleEvent event);
            public void joined(SpaceLifeCycleEvent event);
            public void left(SpaceLifeCycleEvent event);
            public void spaceRenamed(SpaceLifeCycleEvent event);
            public void spaceDescriptionEdited(SpaceLifeCycleEvent event);
            public void spaceAvatarEdited(SpaceLifeCycleEvent event);
    • The grantedLead function is called when a member is promoted as a space manager.

    • The revokedLead function is called when a user is demoted from a space manager.

    • The joined function is called when a user joins a space.

    • The left function is called when a user leaves a space.

    • The spaceRenamed function is called when a space is renamed.

    • The spaceDescriptionEdited function is called when the description of a space is changed.

    • The spaceAvatarEdited function is called when the space avatar is changed.

  3. Add a new configuration to the /social-config/src/main/resources/conf/social/core-configuration.xml file with the type that is the class created in Step 1.

    
    <component>
      <key>org.exoplatform.social.core.application.SpaceActivityPublisher</key>
      <type>org.exoplatform.social.core.application.SpaceActivityPublisher</type>
    </component>
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus