There are the following components in Social that can be overridden:
Relationship listener plugin - Enables you to listen to events of a relationship between users.
Profile listener plugin - Enables you to listen to events of profiles of users.
Space listener plugin - Enables you to listen to events of spaces.
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.
Tutorial
To use the
RelationshipListenerPlugin
class, you can do as follows:
Create a new class, for example,
RelationshipPublisher
that extends RelationshipListenerPlugin
.
public class RelationshipPublisher extends RelationshipListenerPlugin {
...
}
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.
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>
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.
Tutorial
To use the
ProfileListenerPlugin
class, you can do as follows:
Create a new class, for example,
ProfileUpdatesPublisher
that extends ProfileListenerPlugin
.
public class ProfileUpdatesPublisher extends ProfileListenerPlugin {
.....
}
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.
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>
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.
Tutorial
To use the
SpaceListenerPlugin
class, you can do as follows:
Create a new class, for example,
SpaceActivityPublisher
that extends SpaceListenerPlugin
.
public class SpaceActivityPublisher extends SpaceListenerPlugin {
{
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.
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>