Package com.jalios.jcms.mention
Class MentionManager
- java.lang.Object
-
- com.jalios.jcms.mention.MentionManager
-
- All Implemented Interfaces:
JPropertiesListener
public final class MentionManager extends java.lang.Object implements JPropertiesListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MentionManager.EmailSelector
DataSelector used to find any member whose mail starts with given emailPrefix
-
Field Summary
Fields Modifier and Type Field Description java.util.Map<TypeEntry,java.util.List<TypeFieldEntry>>
mentionableTFEByTypeMap
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DBMember
getDBMemberFromEmailPrefix(java.lang.String emailPrefix)
Returns aDBMember
, which is an account, and whose mail starts with the given email prefixjava.lang.String
getHtmlPrefix()
java.lang.String
getIconPrefixProp()
static MentionManager
getInstance()
Member
getMemberFromEmailPrefix(java.lang.String emailPrefix)
Returns a member by searching in Store Members and DBMembers any matching member with email starting with the given email prefixMember
getMemberFromEmailPrefixCache(java.lang.String emailPrefix)
java.util.Set<Member>
getMentionedMemberSet(Publication pub)
Returns mentioned member set in the given publication by searching through all its values (multivaluated && multilingual) An empty set is returned if the Publication is not in a visible statejava.util.Set<Member>
getMentionedMemberSet(TypeFieldEntry tfe, java.lang.String text)
Retrieve member mentionned in the specified text.java.util.Set<Member>
getMentionedMemberSet(java.lang.String text)
Deprecated.java.lang.String
getMentionEmailPrefixFromString(java.lang.String text)
java.lang.String
getMentionHtmlPrefix()
Returns the html prefix build with the following properties : mention.htmlprefix : an html prefix mention.html.icon.prefix-prop: an icon property mention.html.whitespace.prefix: a boolean to define if a whitespace is needed Note : if an icon is defined, the htmlprefix is not usedjava.util.regex.Pattern
getMentionMailPrefixPattern()
java.lang.String
getMentionMailPrefixRegex()
java.util.regex.Pattern
getMentionPattern()
java.util.List<TypeFieldEntry>
getTypeEntryMentionableFields(TypeEntry typeEntry)
boolean
hasWhiteSpacePrefix()
boolean
isMentionEnabled()
void
notifyMention(Publication pub, Member opAuthor, java.util.Set<Member> memberSet)
Notifies mentioned member set on the given Publicationvoid
notifyMention(Publication pub, java.util.Set<Member> memberSet)
Deprecated.since jcms-9.0.2 : usenotifyMention(Publication, Member, Set)
void
propertiesChange(JProperties properties)
Invoked after properties have been modified in JCMS and save on disk.
-
-
-
Field Detail
-
mentionableTFEByTypeMap
public java.util.Map<TypeEntry,java.util.List<TypeFieldEntry>> mentionableTFEByTypeMap
-
-
Method Detail
-
getInstance
public static MentionManager getInstance()
-
propertiesChange
public void propertiesChange(JProperties properties)
Description copied from interface:JPropertiesListener
Invoked after properties have been modified in JCMS and save on disk.You cannot alter the value received in parameters.
Note that properties parameter may be null, a limited set of site properties, or all site properties.
To check that a property has been modified, reload the "current" property instead using
channel.getProperties
orchannel.getProperty
.- Specified by:
propertiesChange
in interfaceJPropertiesListener
- Parameters:
properties
- the properties which have been submitted to change
-
getMentionMailPrefixRegex
public java.lang.String getMentionMailPrefixRegex()
- Returns:
- the mention regexp property value
- Since:
- jcms-9.0.1
-
getMentionPattern
public java.util.regex.Pattern getMentionPattern()
- Returns:
- the mention regexp
Pattern
- Since:
- jcms-9.0.1
-
getMentionMailPrefixPattern
public java.util.regex.Pattern getMentionMailPrefixPattern()
- Returns:
- the mention mail prefix regexp
Pattern
- Since:
- jcms-9.0.1
-
isMentionEnabled
public boolean isMentionEnabled()
- Returns:
- true if mentions are enabled on this webapp
- Since:
- jcms-9.0.1
-
getHtmlPrefix
public java.lang.String getHtmlPrefix()
- Returns:
- the html prefix that will be added to the html of a mentioned member
- Since:
- jcms-9.0.1
-
getIconPrefixProp
public java.lang.String getIconPrefixProp()
- Returns:
- the icon prefix that will be added to the html of a mentioned member
- Since:
- jcms-9.0.1
-
hasWhiteSpacePrefix
public boolean hasWhiteSpacePrefix()
- Returns:
- true if there must be a white space before the rendered mention in wiki
- Since:
- jcms-9.0.1
-
getMentionHtmlPrefix
public java.lang.String getMentionHtmlPrefix()
Returns the html prefix build with the following properties :- mention.htmlprefix : an html prefix
- mention.html.icon.prefix-prop: an icon property
- mention.html.whitespace.prefix: a boolean to define if a whitespace is needed
- Returns:
- the prefix that is displayed before the member name when rendered in a wiki
- Since:
- jcms-9.0.1
-
getMentionedMemberSet
public java.util.Set<Member> getMentionedMemberSet(Publication pub)
Returns mentioned member set in the given publication by searching through all its values (multivaluated && multilingual) An empty set is returned if the Publication is not in a visible state- Parameters:
pub
- thePublication
- Returns:
- the
Set
ofMember
mentioned in givenPublication
- Since:
- jcms-9.0.1
-
getMentionedMemberSet
public java.util.Set<Member> getMentionedMemberSet(java.lang.String text)
Deprecated.- Parameters:
text
- the text to parse- Returns:
- the
Set
ofMember
mentioned in given text - Since:
- jcms-9.0.1
-
getMentionedMemberSet
public java.util.Set<Member> getMentionedMemberSet(TypeFieldEntry tfe, java.lang.String text)
Retrieve member mentionned in the specified text.- Parameters:
tfe
- the TypeFieldEntry corresponding to the field in which text is stored, used to detect wiki vs wysiwyg field, may be null but not recommended.text
- the text to parse- Returns:
- the
Set
ofMember
mentioned in given text - Since:
- jcms-10.0.0
-
getMemberFromEmailPrefix
public Member getMemberFromEmailPrefix(java.lang.String emailPrefix)
Returns a member by searching in Store Members and DBMembers any matching member with email starting with the given email prefix- Parameters:
emailPrefix
- the prefix of the member email- Returns:
- a member based on given email prefix
- Since:
- jcms-9.0.1
-
getMentionEmailPrefixFromString
public java.lang.String getMentionEmailPrefixFromString(java.lang.String text)
- Parameters:
text
- the text to extract mail from- Returns:
- the string matched after the @ symbol of given text
- Since:
- jcms-9.0.2
-
getMemberFromEmailPrefixCache
public Member getMemberFromEmailPrefixCache(java.lang.String emailPrefix)
- Parameters:
emailPrefix
- the email prefix- Returns:
- a member from the cache
- Since:
- jcms-9.0.1
-
getDBMemberFromEmailPrefix
public DBMember getDBMemberFromEmailPrefix(java.lang.String emailPrefix)
Returns aDBMember
, which is an account, and whose mail starts with the given email prefix- Parameters:
emailPrefix
- the email prefix- Returns:
- a
DBMember
whose mail starts with the given email prefix - Since:
- jcms-9.0.1
-
getTypeEntryMentionableFields
public java.util.List<TypeFieldEntry> getTypeEntryMentionableFields(TypeEntry typeEntry)
- Parameters:
typeEntry
- theTypeEntry
- Returns:
- the list of wiki
TypeFieldEntry
for givenTypeEntry
- Since:
- jcms-9.0.1
-
notifyMention
@Deprecated public void notifyMention(Publication pub, java.util.Set<Member> memberSet)
Deprecated.since jcms-9.0.2 : usenotifyMention(Publication, Member, Set)
Notifies mentioned member set on the given Publication- Parameters:
pub
- thePublication
memberSet
- the set of members that will receive the alert- Since:
- jcms-9.0.1
-
notifyMention
public void notifyMention(Publication pub, Member opAuthor, java.util.Set<Member> memberSet)
Notifies mentioned member set on the given Publication- Parameters:
pub
- thePublication
opAuthor
- the op authormemberSet
- the set of members that will receive the alert- Since:
- jcms-9.0.2
-
-