Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.interceptor
Class KeywordInterceptor

java.lang.Object
  extended by com.jivesoftware.forum.interceptor.KeywordInterceptor
All Implemented Interfaces:
MessageInterceptor

public class KeywordInterceptor
extends java.lang.Object
implements MessageInterceptor

An interceptor that looks for certain keywords in the message subject or body and notifies a list of email addresses if those keywords are found. Optionally, stemming can be enabled. Stemming is a mechanism for matching multiple versions of the same word. For example, when stemming is enabled the word "cats" will match "cat" and "thrill" will match "thrilling". So, stemming makes the keyword list easier to manage when you to be notified of any version of a particular word.


Field Summary
 
Fields inherited from interface com.jivesoftware.forum.MessageInterceptor
TYPE_ALL, TYPE_BOTH, TYPE_EDIT, TYPE_POST, TYPE_PRE
 
Constructor Summary
KeywordInterceptor()
           
KeywordInterceptor(int objectType, long objectID)
           
 
Method Summary
 java.lang.String getBlockError()
           
 java.lang.String getBlockQueryString()
           
 java.lang.String getEmailAddress()
          Returns the email address that notification emails will appear to be from.
 java.lang.String getEmailBody()
          Deprecated. replaced by getEmailBody(java.util.Locale)
 java.lang.String getEmailBody(java.util.Locale locale)
          Returns the body of the nofication emails.
 java.lang.String getEmailName()
          Returns the name that notification emails will appear to be from.
 java.lang.String getEmailNotifyList()
          Returns the list of email addresses that will be notified when keywords are found.
 java.lang.String getEmailQueryString()
          Returns the query string that messages will be matched against.
 java.lang.String getEmailSubject()
          Deprecated. replaced by getEmailSubject(java.util.Locale)
 java.lang.String getEmailSubject(java.util.Locale locale)
          Returns the subject of the notification emails.
 java.lang.String getModerationQueryString()
           
 int getType()
          Returns the type of the interceptor.
 void invokeInterceptor(ForumMessage message, int type)
          Invokes the interceptor on the specified message.
 boolean isStemmingEnabled()
          Returns true if stemming will be applied to keywords.
 void setBlockError(java.lang.String blockError)
           
 void setBlockQueryString(java.lang.String blockQueryString)
           
 void setEmailAddress(java.lang.String emailAddress)
          Sets the email address that notification emails will appear to be from.
 void setEmailBody(java.lang.String emailBody)
          Deprecated. replaced by setEmailBody(String, java.util.Locale)
 void setEmailBody(java.lang.String emailBody, java.util.Locale locale)
          Sets the body of the nofication emails.
 void setEmailName(java.lang.String emailName)
          Sets the name that notification emails will appear to be from.
 void setEmailNotifyList(java.lang.String notifyList)
          Sets the list of email addresses that will be notified when keywords are found.
 void setEmailQueryString(java.lang.String emailQueryString)
          Sets the query string that messages will be matched against in order to send nofication emails.
 void setEmailSubject(java.lang.String emailSubject)
          Deprecated. replaced by setEmailSubject(String, java.util.Locale)
 void setEmailSubject(java.lang.String emailSubject, java.util.Locale locale)
          Sets the subject of the nofitication emails.
 void setModerationQueryString(java.lang.String moderationQueryString)
           
 void setStemmingEnabled(boolean stemmingEnabled)
          Toggles whether stemming will be applied to keywords.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeywordInterceptor

public KeywordInterceptor()

KeywordInterceptor

public KeywordInterceptor(int objectType,
                          long objectID)
Method Detail

isStemmingEnabled

public boolean isStemmingEnabled()
Returns true if stemming will be applied to keywords. Stemming is a mechanism for matching multiple versions of the same word. For example, when stemming is enabled the word "cats" will match "cat" and "thrill" will match "thrilling". So, stemming makes the keyword list easier to manage when you to be notified of any version of a particular word.

The stemming implementation uses the Porter algorithm, which is only suitable for English text. If your content is non-english, stemming should be disabled.

Returns:
true if stemming is enabled.

setStemmingEnabled

public void setStemmingEnabled(boolean stemmingEnabled)
Toggles whether stemming will be applied to keywords. Stemming is a mechanism for matching multiple versions of the same word. For example, when stemming is enabled the word "cats" will match "cat" and "thrill" will match "thrilling".

The stemming implementation uses the Porter algorithm, which is only suitable for English text. If your content is non-english, stemming should be disabled.

Parameters:
stemmingEnabled - true if stemming should be enabled.

getModerationQueryString

public java.lang.String getModerationQueryString()

setModerationQueryString

public void setModerationQueryString(java.lang.String moderationQueryString)

getBlockQueryString

public java.lang.String getBlockQueryString()

setBlockQueryString

public void setBlockQueryString(java.lang.String blockQueryString)

getBlockError

public java.lang.String getBlockError()

setBlockError

public void setBlockError(java.lang.String blockError)

getEmailQueryString

public java.lang.String getEmailQueryString()
Returns the query string that messages will be matched against. If a match is found, a notification email will be sent.

Returns:
the list comma-delimited list of keywords.

setEmailQueryString

public void setEmailQueryString(java.lang.String emailQueryString)
Sets the query string that messages will be matched against in order to send nofication emails. If a match is found, a notification email will be sent.

Parameters:
emailQueryString - the query string.

getEmailNotifyList

public java.lang.String getEmailNotifyList()
Returns the list of email addresses that will be notified when keywords are found.

Returns:
the comma-delimited list of notification email addresses.

setEmailNotifyList

public void setEmailNotifyList(java.lang.String notifyList)
Sets the list of email addresses that will be notified when keywords are found.

Parameters:
notifyList - the comma-delimited list of notification email addresses.

getEmailName

public java.lang.String getEmailName()
Returns the name that notification emails will appear to be from.

Returns:
the name that notification emails will appear from.

setEmailName

public void setEmailName(java.lang.String emailName)
Sets the name that notification emails will appear to be from.

Parameters:
emailName - the name that notification emails will appear from.

getEmailAddress

public java.lang.String getEmailAddress()
Returns the email address that notification emails will appear to be from.

Returns:
the email address that notification emails will appear from.

setEmailAddress

public void setEmailAddress(java.lang.String emailAddress)
Sets the email address that notification emails will appear to be from.

Parameters:
emailAddress - the email address that notification emails will appear from.

getEmailSubject

public java.lang.String getEmailSubject()
Deprecated. replaced by getEmailSubject(java.util.Locale)

Returns the subject of the notification emails.

Returns:
the subject of the notification emails.

getEmailSubject

public java.lang.String getEmailSubject(java.util.Locale locale)
Returns the subject of the notification emails.

Returns:
the subject of the notification emails.

setEmailSubject

public void setEmailSubject(java.lang.String emailSubject)
Deprecated. replaced by setEmailSubject(String, java.util.Locale)

Sets the subject of the nofitication emails.

Parameters:
emailSubject - the subject of notification emails.

setEmailSubject

public void setEmailSubject(java.lang.String emailSubject,
                            java.util.Locale locale)
Sets the subject of the nofitication emails.

Parameters:
emailSubject - the subject of notification emails.

getEmailBody

public java.lang.String getEmailBody()
Deprecated. replaced by getEmailBody(java.util.Locale)

Returns the body of the nofication emails.

Returns:
the body of the notification emails.

getEmailBody

public java.lang.String getEmailBody(java.util.Locale locale)
Returns the body of the nofication emails.

Returns:
the body of the notification emails.

setEmailBody

public void setEmailBody(java.lang.String emailBody)
Deprecated. replaced by setEmailBody(String, java.util.Locale)

Sets the body of the nofication emails.

Parameters:
emailBody - the body of the notification emails.

setEmailBody

public void setEmailBody(java.lang.String emailBody,
                         java.util.Locale locale)
Sets the body of the nofication emails.

Parameters:
emailBody - the body of the notification emails.

getType

public int getType()
Description copied from interface: MessageInterceptor
Returns the type of the interceptor.

Specified by:
getType in interface MessageInterceptor
Returns:
the interceptor type.

invokeInterceptor

public void invokeInterceptor(ForumMessage message,
                              int type)
                       throws MessageRejectedException
Description copied from interface: MessageInterceptor
Invokes the interceptor on the specified message. The interceptor can either modify the message, or throw a MessageRejectedException to block it from being posted. Only a TYPE_PRE interceptor can throw an exception.

Specified by:
invokeInterceptor in interface MessageInterceptor
Parameters:
message - the message to take action on.
Throws:
MessageRejectedException - if the message should be prevented from being posted.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.