Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.database
Class DbAnnouncementManager

java.lang.Object
  extended by com.jivesoftware.forum.database.DbAnnouncementManager
All Implemented Interfaces:
JiveManager, AnnouncementManager, CategoryListener, ForumListener

public class DbAnnouncementManager
extends java.lang.Object
implements AnnouncementManager, JiveManager, CategoryListener, ForumListener

Database implementation of the AnnouncementManager interface.

Since:
4.0

Method Summary
 void addAnnouncement(Announcement announcement)
          Adds an an announcement to the database.
 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.
 Announcement createAnnouncement(User user)
          Creates a new system announcement.
 Announcement createAnnouncement(User user, Forum forum)
          Creates a new forum announcement.
 Announcement createAnnouncement(User user, ForumCategory category)
          Creates a new category announcement.
 void deleteAnnouncement(Announcement announcement)
          Deletes an announcement.
 void destroy()
          Notifies the manager to release any resources that may be holding on too.
 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.
 Announcement getAnnouncement(long announcementID)
          Returns an announcement by announcement ID.
 int getAnnouncementCount(java.lang.Object container)
          Returns the count of all currently viewable announcements in a container.
 int getAnnouncementCount(java.lang.Object container, java.util.Date startDate, java.util.Date endDate)
          Returns the count of all announcements in a container that are viewable within the specified date range.
 java.util.Iterator getAnnouncements(java.lang.Object container)
          Returns all currently viewable announcements in a container.
 java.util.Iterator getAnnouncements(java.lang.Object container, java.util.Date startDate, java.util.Date endDate)
          Returns the announcements in a container that are viewable within a specified date range.If container is null then system announcements will be returned.
static DbAnnouncementManager getInstance()
           
 int getRecursiveAnnouncementCount(ForumCategory category)
          Returns the count of all currently viewable announcements in a ForumCategory and its child Forums and SubCategories.
 java.util.Iterator getRecursiveAnnouncements(ForumCategory category, int startIndex, int numResults)
          Returns all currently viewable announcements in a ForumCategory and its child Forums and SubCategories.
 void initialize()
          Initialize the manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static DbAnnouncementManager getInstance()

initialize

public void initialize()
Description copied from interface: JiveManager
Initialize the manager. It is within this method that it is ok to create, access and/or otherwise use external classes (including caches). Until this method is called implementation should not access any external classes that could possibly either access one of the main Factory classes or any caches since doing so can cause deadlocks and possible clustering issues during startup.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
initialize in interface JiveManager

destroy

public void destroy()
Description copied from interface: JiveManager
Notifies the manager to release any resources that may be holding on too. This could also be used to clear out the managers caches, etc.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
destroy in interface JiveManager

createAnnouncement

public Announcement createAnnouncement(User user)
                                throws UnauthorizedException
Description copied from interface: AnnouncementManager
Creates a new system announcement. After an announcement is created and the appropriate values are set, it must be added to the database by calling the AnnouncementManager.addAnnouncement(Announcement) method.

Specified by:
createAnnouncement in interface AnnouncementManager
Parameters:
user - the user creating the announcement.
Returns:
a new Announcement.
Throws:
UnauthorizedException - if not allowed to create a system annoucement.

createAnnouncement

public Announcement createAnnouncement(User user,
                                       ForumCategory category)
                                throws UnauthorizedException
Description copied from interface: AnnouncementManager
Creates a new category announcement. After an announcement is created and the appropriate values are set, it must be added to the database by calling the AnnouncementManager.addAnnouncement(Announcement) method.

Specified by:
createAnnouncement in interface AnnouncementManager
Parameters:
user - the user creating the announcement.
category - the category to add the announcement to.
Returns:
a new Announcement.
Throws:
UnauthorizedException - if not allowed to create a system annoucement.

createAnnouncement

public Announcement createAnnouncement(User user,
                                       Forum forum)
                                throws UnauthorizedException
Description copied from interface: AnnouncementManager
Creates a new forum announcement. After an announcement is created and the appropriate values are set, it must be added to the database by calling the AnnouncementManager.addAnnouncement(Announcement) method.

Specified by:
createAnnouncement in interface AnnouncementManager
Parameters:
user - the user creating the announcement.
forum - the forum to add the announcement to.
Returns:
a new Announcement.
Throws:
UnauthorizedException - if not allowed to create a system annoucement.

addAnnouncement

public void addAnnouncement(Announcement announcement)
                     throws UnauthorizedException
Description copied from interface: AnnouncementManager
Adds an an announcement to the database. This method must be called after the announcement is created and all appropriate values on it have been set. After this method is called, the announcement will be immediately viewable to others (assuming the start date permits this).

Specified by:
addAnnouncement in interface AnnouncementManager
Parameters:
announcement - the announcement to add to the database.
Throws:
UnauthorizedException - if not allowed to create a system annoucement.

getAnnouncement

public Announcement getAnnouncement(long announcementID)
                             throws AnnouncementNotFoundException
Description copied from interface: AnnouncementManager
Returns an announcement by announcement ID.

Specified by:
getAnnouncement in interface AnnouncementManager
Parameters:
announcementID - the ID of the announcement to return.
Returns:
the announcement.
Throws:
AnnouncementNotFoundException - if the announcement could not be loaded or does not exist.

getAnnouncementCount

public int getAnnouncementCount(java.lang.Object container)
Description copied from interface: AnnouncementManager
Returns the count of all currently viewable announcements in a container. If container is null than the count of system announcements will be returned. Otherwise, the container should be a ForumCategory or Forum object.

Specified by:
getAnnouncementCount in interface AnnouncementManager
Parameters:
container - a forum, category, or null for system announcements.
Returns:
the count of all currently viewable announcements in the container.

getRecursiveAnnouncementCount

public int getRecursiveAnnouncementCount(ForumCategory category)
Description copied from interface: AnnouncementManager
Returns the count of all currently viewable announcements in a ForumCategory and its child Forums and SubCategories. If the category is null then the count of all announcements in the system will be returned, including System Announcements.

Specified by:
getRecursiveAnnouncementCount in interface AnnouncementManager
Parameters:
category - a category, or null for system announcements.
Returns:
the recursive count of all currently viewable announcements in the category and its children.

getAnnouncementCount

public int getAnnouncementCount(java.lang.Object container,
                                java.util.Date startDate,
                                java.util.Date endDate)
Description copied from interface: AnnouncementManager
Returns the count of all announcements in a container that are viewable within the specified date range. If container is null than the count of system announcements will be returned. Otherwise, the container should be a ForumCategory or Forum object. If startDate or endDate are null than the date range will be unbounded in that direction. For example, to get a count of all announcements regardless of starting and ending dates, pass in null as the value for both parameters.

Specified by:
getAnnouncementCount in interface AnnouncementManager
Parameters:
container - a forum, category, or null for system announcements.
startDate - the start date of announcements, or null to leave this value unbounded.
endDate - the end date of announcements, or null to leave this value unbounded.
Returns:
the count of all announcements in the container that are viewable within the specified date range.

getAnnouncements

public java.util.Iterator getAnnouncements(java.lang.Object container)
Description copied from interface: AnnouncementManager
Returns all currently viewable announcements in a container. If container is null than system announcements will be returned. Otherwise, the container should be a ForumCategory or Forum object.

Specified by:
getAnnouncements in interface AnnouncementManager
Parameters:
container - a forum, category, or null for system announcements.
Returns:
the count of all currently viewable announcements in the container.

getAnnouncements

public java.util.Iterator getAnnouncements(java.lang.Object container,
                                           java.util.Date startDate,
                                           java.util.Date endDate)
Description copied from interface: AnnouncementManager
Returns the announcements in a container that are viewable within a specified date range.If container is null then system announcements will be returned. Otherwise, the container should be a ForumCategory or Forum object. If startDate or endDate are null than the date range will be unbounded in that direction. For example, to get all announcements regardless of starting and ending dates, pass in null as the value for both parameters.

Specified by:
getAnnouncements in interface AnnouncementManager
Parameters:
container - a forum, category, or null for system announcements.
startDate - the start date of announcements, or null to leave this value unbounded.
endDate - the end date of announcements, or null to leave this value unbounded.
Returns:
all announcements in the container that are viewable within the the specified date range.

getRecursiveAnnouncements

public java.util.Iterator getRecursiveAnnouncements(ForumCategory category,
                                                    int startIndex,
                                                    int numResults)
Description copied from interface: AnnouncementManager
Returns all currently viewable announcements in a ForumCategory and its child Forums and SubCategories. If the category is null then the all viewable announcements in the system will be returned, including the System Announcements.

Specified by:
getRecursiveAnnouncements in interface AnnouncementManager
Parameters:
category - a category, or null for system announcements.
Returns:
the recursive count of all currently viewable announcements in the category and its children.

deleteAnnouncement

public void deleteAnnouncement(Announcement announcement)
Description copied from interface: AnnouncementManager
Deletes an announcement.

Specified by:
deleteAnnouncement in interface AnnouncementManager
Parameters:
announcement - the announcement to delete.

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.

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.

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.

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.

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.

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.

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.

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.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.