Jive Forums API (5.5.8) Developer Javadocs

com.jivesoftware.forum.expert
Class OpenQuestionMonitor

java.lang.Object
  extended by com.jivesoftware.forum.expert.OpenQuestionMonitor
All Implemented Interfaces:
CategoryListener, ForumListener

public class OpenQuestionMonitor
extends java.lang.Object
implements ForumListener, CategoryListener

Service to monitor open questions. It periodically finds all questions that were created a certain number of hours ago and that are in the Question.State#open open state. It then sends an email alert to a configurable list of email addresses.


Method Summary
 void categoryAdded(CategoryEvent event)
          Fired when a category has been added to the system.
 void categoryDeleted(CategoryEvent event)
          Fired when a category is about to be deleted from the system.
 void categoryModified(CategoryEvent event)
          Fired when a category has been modified.
 void categoryMoved(CategoryEvent event)
          Fired when a category has been moved from one category to another.
 void forumAdded(ForumEvent event)
          Fired when a forum has been added to the system.
 void forumDeleted(ForumEvent event)
          Fired when a forum is about to be deleted from the system.
 void forumMerged(ForumEvent event)
          Fired when a forum is merged into another forum.
 void forumModified(ForumEvent event)
          Fired when a forum is modified.
 void forumMoved(ForumEvent event)
          Fired when a forum has been moved from one category to another.
 OpenQuestionAlertSettings getAlertSettings(java.lang.Object forumElement)
          Returns an OpenQuestionAlertSettings instance associated with the forumElement argument. forumElement must be an instance of either Forum or ForumCategory, otherwise IllegalArgumentException is thrown.
 java.lang.String getEmailSubject(java.util.Locale locale)
          Returns the subject of the notification emails.
 java.lang.String getHTMLEmailBody(java.util.Locale locale)
          Returns the HTML body of the nofication emails.
static OpenQuestionMonitor getInstance()
           
 java.lang.String getTextEmailBody(java.util.Locale locale)
          Returns the plain-text body of the nofication emails.
 boolean isEnabled()
          Returns true if the open question monitoring feature is enabled.
 void setAlertSettings(OpenQuestionAlertSettings alertSettings)
          Commits changes made to an OpenQuestionAlertSettings instance.
 void setEmailSubject(java.lang.String emailSubject, java.util.Locale locale)
          Sets the subject of the nofitication emails.
 void setHTMLEmailBody(java.lang.String htmlEmailBody, java.util.Locale locale)
          Sets the HTML body of the nofication emails.
 void setTextEmailBody(java.lang.String textEmailBody, java.util.Locale locale)
          Sets the plain-text body of the nofication emails.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static OpenQuestionMonitor getInstance()

getAlertSettings

public OpenQuestionAlertSettings getAlertSettings(java.lang.Object forumElement)
Returns an OpenQuestionAlertSettings instance associated with the forumElement argument. forumElement must be an instance of either Forum or ForumCategory, otherwise IllegalArgumentException is thrown. If no settings instance is currently associated with the supplied Forum or Category, a new one will be created and returned.

Parameters:
forumElement - an instance of either Forum or ForumCategory with which the returned OpenQuestionAlertSettings will be associated.
Returns:
an OpenQuestionAlertSettings instance associated with the supplied Forum or ForumCategory.

setAlertSettings

public void setAlertSettings(OpenQuestionAlertSettings alertSettings)
                      throws java.io.IOException
Commits changes made to an OpenQuestionAlertSettings instance. This should be called after any modifications are made to the settings instance to ensure changes are persisted.

Parameters:
alertSettings - the OpenQuestionAlertSettings to persist.
Throws:
java.io.IOException - if writing to the underlying persistent store fails.

forumAdded

public void forumAdded(ForumEvent event)
Description copied from interface: ForumListener
Fired when a forum has been added to the system.

Specified by:
forumAdded in interface ForumListener
Parameters:
event - the event object.

forumModified

public void forumModified(ForumEvent event)
Description copied from interface: ForumListener
Fired when a forum is modified.

Specified by:
forumModified in interface ForumListener
Parameters:
event - the event object.

forumMoved

public void forumMoved(ForumEvent event)
Description copied from interface: ForumListener
Fired when a forum has been moved from one category to another.

Specified by:
forumMoved in interface ForumListener
Parameters:
event - the event object.

forumMerged

public void forumMerged(ForumEvent event)
Description copied from interface: ForumListener
Fired when a forum is merged into another forum.

Specified by:
forumMerged in interface ForumListener
Parameters:
event - the event object.

forumDeleted

public void forumDeleted(ForumEvent event)
Description copied from interface: ForumListener
Fired when a forum is about to be deleted from the system. This event will be fired when an individual forum is deleted or when the forum's category is deleted. Because various code pieces may depend on this event for performing cleanup tasks, it's guaranteed that this method will be called before the forum is deleted from the database.

Specified by:
forumDeleted in interface ForumListener
Parameters:
event - the event object.

categoryAdded

public void categoryAdded(CategoryEvent event)
Description copied from interface: CategoryListener
Fired when a category has been added to the system.

Specified by:
categoryAdded in interface CategoryListener
Parameters:
event - the event object.

categoryModified

public void categoryModified(CategoryEvent event)
Description copied from interface: CategoryListener
Fired when a category has been modified.

Specified by:
categoryModified in interface CategoryListener
Parameters:
event - the event object.

categoryMoved

public void categoryMoved(CategoryEvent event)
Description copied from interface: CategoryListener
Fired when a category has been moved from one category to another.

Specified by:
categoryMoved in interface CategoryListener
Parameters:
event - the event object.

categoryDeleted

public void categoryDeleted(CategoryEvent event)
Description copied from interface: CategoryListener
Fired when a category is about to be deleted from the system. Because various code pieces may depend on this event for performing cleanup tasks, it's guaranteed that this method will be called before the category is deleted from the database.

Specified by:
categoryDeleted in interface CategoryListener
Parameters:
event - the event object.

isEnabled

public boolean isEnabled()
Returns true if the open question monitoring feature is enabled.

Returns:
true if enabled.

getEmailSubject

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

Parameters:
locale -
Returns:
the subject of the 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.
locale -

getTextEmailBody

public java.lang.String getTextEmailBody(java.util.Locale locale)
Returns the plain-text body of the nofication emails. A plain-text and HTML email body can be set if either is null than only the other body will be sent.

Parameters:
locale -
Returns:
the plain-text body of the notification emails.

setTextEmailBody

public void setTextEmailBody(java.lang.String textEmailBody,
                             java.util.Locale locale)
Sets the plain-text body of the nofication emails. The body can be text or a Freemarker template. The template has access to the following values in the context, which correspond to the thread and root message linked to a question. Values are:

Parameters:
textEmailBody - the plain-text body of the notification emails.
locale -

getHTMLEmailBody

public java.lang.String getHTMLEmailBody(java.util.Locale locale)
Returns the HTML body of the nofication emails. A plain-text and HTML email body can be set if either is null than only the other body will be sent.

Parameters:
locale -
Returns:
the HTML body of the notification emails.

setHTMLEmailBody

public void setHTMLEmailBody(java.lang.String htmlEmailBody,
                             java.util.Locale locale)
Sets the HTML body of the nofication emails. The body can be HTML or a Freemarker template. The template has access to the following values in the context, which correspond to the thread and root message linked to a question. Values are:

Parameters:
htmlEmailBody - the HTML body of the notification emails.
locale -

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.