Class Utils
java.lang.Object
org.exoplatform.social.notification.Utils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringaddExternalFlag(org.exoplatform.social.core.identity.model.Identity userIdentity) Add the external flag if the user is an externalstatic StringformatContent(String content) Get 150 first characters of a stringstatic org.exoplatform.social.core.manager.ActivityManagergetDestinataires(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, org.exoplatform.social.core.space.model.Space space) Gets remote Ids of all users who receive a notification message when an activity is posted in a space.static org.exoplatform.social.core.manager.IdentityManagergetMentioners(String title, String posterId, String spaceId) Gets the list of mentioners in a message that is not the posterstatic org.exoplatform.social.core.manager.RelationshipManagerstatic <T> TgetService(Class<T> clazz) static org.exoplatform.social.core.space.spi.SpaceServicestatic StringGets a remote Id from a user's identity Id.static booleanisActivityNotificationsEnabled(String activityType) Checks if the notification is enabled for activities of type activityTypestatic booleanisSpaceActivity(org.exoplatform.social.core.activity.model.ExoSocialActivity activity) Checks if an activity is created in a space or not.static booleanisValidUrl(String url) Validates URL.static StringprocessLinkTitle(String title) static StringprocessMentions(String title) Finds all mention prefixes from an activity title, then adds a domain name to ensure the link to a user profile is correct.static voidsendToActivityPoster(Set<String> receivers, String activityPosterId, String posterId, String spaceId) Checks if a notification message is sent to an activity poster when a new comment is created.static voidstatic voidstatic voidstatic voidsendToStreamOwner(Set<String> receivers, String streamOwner, String posteId) Checks if a notification message is sent to a stream owner or not.toListUserIds(String... userIds) Converts an array of remote user Ids into a list.
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
getService
-
getUserId
Gets a remote Id from a user's identity Id.- Parameters:
identityId- The user's identity Id.- Returns:
- The remote Id.
-
toListUserIds
Converts an array of remote user Ids into a list.- Parameters:
userIds- The remote user Ids.- Returns:
- The list of remote Ids.
-
isSpaceActivity
public static boolean isSpaceActivity(org.exoplatform.social.core.activity.model.ExoSocialActivity activity) Checks if an activity is created in a space or not.- Parameters:
activity- The activity to be checked.- Returns:
- The returned value is "true" if the activity is created, or "false" if the activity is not created.
-
sendToCommeters
-
sendToLikers
-
sendToStreamOwner
Checks if a notification message is sent to a stream owner or not.- Parameters:
receivers- The list of users receiving the notification message.streamOwner- The owner of activity stream.posteId- Id of the user who has posted the activity.
-
sendToActivityPoster
public static void sendToActivityPoster(Set<String> receivers, String activityPosterId, String posterId, String spaceId) Checks if a notification message is sent to an activity poster when a new comment is created.- Parameters:
receivers- The list of users receiving the notification message.activityPosterId- Id of the activity poster.posterId- Id of the user who has commented.
-
sendToMentioners
-
processMentions
Finds all mention prefixes from an activity title, then adds a domain name to ensure the link to a user profile is correct.- Parameters:
title- The activity title.- Returns:
- The new title which contains the correct link to the user profile.
-
getMentioners
Gets the list of mentioners in a message that is not the poster- Parameters:
title- the activity titleposterId- id of the poster- Returns:
- list of mentioners
-
processLinkTitle
-
isValidUrl
Validates URL.- Parameters:
url- string to validate- Returns:
- true if url is valid (url started with http/https/www/ftp ...)
-
getDestinataires
public static List<String> getDestinataires(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, org.exoplatform.social.core.space.model.Space space) Gets remote Ids of all users who receive a notification message when an activity is posted in a space.- Parameters:
activity- The created activity.space- The space which contains the activity.- Returns:
- The remote Ids.
-
formatContent
Get 150 first characters of a string- Parameters:
content-- Returns:
-
getIdentityManager
public static org.exoplatform.social.core.manager.IdentityManager getIdentityManager() -
getSpaceService
public static org.exoplatform.social.core.space.spi.SpaceService getSpaceService() -
getActivityManager
public static org.exoplatform.social.core.manager.ActivityManager getActivityManager() -
getRelationshipManager
public static org.exoplatform.social.core.manager.RelationshipManager getRelationshipManager() -
isActivityNotificationsEnabled
Checks if the notification is enabled for activities of type activityType- Parameters:
activityType- type of activity to check if their notification is enabled- Returns:
- true if the notification is enabled for this Activity Type
-
addExternalFlag
public static String addExternalFlag(org.exoplatform.social.core.identity.model.Identity userIdentity) Add the external flag if the user is an external- Parameters:
userIdentity-- Returns:
- full username
-