Class MentionUtils
java.lang.Object
org.exoplatform.social.core.utils.MentionUtils
-
Method Summary
Modifier and TypeMethodDescriptiongetMentionedRoles(String message, String identityId) Gives the space roles mentioned as@role:spaceIdentityIdin a message for the given space, a mention ending on a whitespace, the end of the text or the<of a tag.getMentionedUsernames(String message) Gives the usernames mentioned as@usernamein a message, a mention ending on a whitespace, the end of the text or the<of a tag, and keeps only the enabled, non-deleted users.static StringsubstituteRoles(org.exoplatform.social.core.manager.IdentityManager identityManager, String message, Locale locale) Replaces every@role:spaceIdentityIdmention of an enabled space by the space role link, followed by the<of the tag the mention preceded, or by a single space.static StringsubstituteRoleWithLocale(String message, Locale locale) static voidsubstituteRoleWithLocale(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, Locale locale) static StringsubstituteUsernames(String message) static StringsubstituteUsernames(String portalOwner, String message) static StringsubstituteUsernames(String portalOwner, String message, Locale locale) static StringsubstituteUsernames(String message, Locale locale) static voidsubstituteUsernames(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, String portalOwner) static voidsubstituteUsernames(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, List<String> templateParamKeys, String portalOwner) static StringsubstituteUsernames(org.exoplatform.social.core.manager.IdentityManager identityManager, String portalOwner, String message) static StringsubstituteUsernames(org.exoplatform.social.core.manager.IdentityManager identityManager, String portalOwner, String message, Locale locale) Replaces every@usernamemention of an enabled user by the user's profile link, then every role mention by its role link (seesubstituteRoles(IdentityManager, String, Locale)).
-
Method Details
-
getMentionedUsernames
Gives the usernames mentioned as@usernamein a message, a mention ending on a whitespace, the end of the text or the<of a tag, and keeps only the enabled, non-deleted users.- Parameters:
message- the message text or HTML- Returns:
- the mentioned usernames, empty when none
-
getMentionedRoles
Gives the space roles mentioned as@role:spaceIdentityIdin a message for the given space, a mention ending on a whitespace, the end of the text or the<of a tag.- Parameters:
message- the message text or HTMLidentityId- the identity id of the space whose role mentions are kept- Returns:
- the mentioned roles, empty when none
-
substituteUsernames
-
substituteUsernames
-
substituteUsernames
-
substituteUsernames
-
substituteUsernames
public static void substituteUsernames(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, String portalOwner) -
substituteUsernames
-
substituteUsernames
-
substituteUsernames
public static String substituteUsernames(org.exoplatform.social.core.manager.IdentityManager identityManager, String portalOwner, String message, Locale locale) Replaces every@usernamemention of an enabled user by the user's profile link, then every role mention by its role link (seesubstituteRoles(IdentityManager, String, Locale)). The link is followed by the<of the tag the mention preceded, or by a single space.- Parameters:
identityManager- the service resolving the mentioned identitiesportalOwner- the portal owner used to build the profile URLsmessage- the message text or HTMLlocale- the locale of the role labels- Returns:
- the message with its mentions substituted
-
substituteRoles
public static String substituteRoles(org.exoplatform.social.core.manager.IdentityManager identityManager, String message, Locale locale) Replaces every@role:spaceIdentityIdmention of an enabled space by the space role link, followed by the<of the tag the mention preceded, or by a single space.- Parameters:
identityManager- the service resolving the space identitiesmessage- the message text or HTMLlocale- the locale of the role labels- Returns:
- the message with its role mentions substituted
-
substituteRoleWithLocale
public static void substituteRoleWithLocale(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, Locale locale) -
substituteRoleWithLocale
-