Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.database
Class DbAnnouncement

java.lang.Object
  extended by com.jivesoftware.forum.database.DbAnnouncement
All Implemented Interfaces:
Announcement, Cacheable, com.tangosol.io.ExternalizableLite, java.io.Serializable

public class DbAnnouncement
extends java.lang.Object
implements Announcement, Cacheable, com.tangosol.io.ExternalizableLite

Database implementation of the Announcement interface.

Since:
4.0
See Also:
Serialized Form

Constructor Summary
DbAnnouncement()
          Constructor for internal use only.
DbAnnouncement(int objectType, long objectID, long userID)
           
DbAnnouncement(long announcementID)
          Loads an existing announcement based on announcement ID.
 
Method Summary
 void deleteAttachment(Attachment attachment)
          Deletes an attachment that belongs to the announcement.
 void deleteProperty(java.lang.String name)
          Deletes an extended property.
 boolean equals(java.lang.Object object)
           
 int getAttachmentCount()
          Returns the number of attachments the announcement has.
 java.util.Iterator getAttachments()
          Returns an Iterator for all the attachments of the message.
 java.lang.String getBody()
          Returns the announcement body.
 int getCachedSize()
          Returns the approximate size of the Object in bytes.
 long getContainerObjectID()
          Returns the object ID of the announcement container.
 int getContainerObjectType()
          Returns the object type of the announcement container.
 java.util.Date getEndDate()
          Returns the date when the announcement should not longer be visible.
 long getID()
          Returns the unique ID of the announcement, or -1 if the announcement hasn't been added to the database yet.
 java.lang.String getProperty(java.lang.String name)
          Returns an extended property of the announcement.
 java.util.Iterator getPropertyNames()
          Returns an Iterator for all the names of the extended properties.
 java.util.Date getStartDate()
          Returns the date when the announcement should first be visible.
 java.lang.String getSubject()
          Returns the announcement subject.
 java.lang.String getUnfilteredBody()
          Returns the announceement body, bypassing any active filters.
 java.lang.String getUnfilteredProperty(java.lang.String name)
          Returns an extended property of the announcement, bypassing any filters.
 java.lang.String getUnfilteredSubject()
          Returns the annoucenment subject, bypassing any active filters.
 User getUser()
          Returns the User that is the author of the announcemnt.
 int hashCode()
           
protected  void insertIntoDb()
           
 void readExternal(java.io.DataInput in)
           
 void setBody(java.lang.String body)
          Sets the body of this announcement.
 void setEndDate(java.util.Date endDate)
          Sets the date when the announcement should not longer be visible.
 void setProperty(java.lang.String name, java.lang.String value)
          Sets an extended property of this annoucement.
 void setStartDate(java.util.Date startDate)
          Sets the start date for when the announcement should first be visible.
 void setSubject(java.lang.String subject)
          Sets the announcement subject.
 java.lang.String toString()
           
 void writeExternal(java.io.DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DbAnnouncement

public DbAnnouncement(long announcementID)
               throws AnnouncementNotFoundException
Loads an existing announcement based on announcement ID.

Parameters:
announcementID - the ID of the announcement.
Throws:
AnnouncementNotFoundException

DbAnnouncement

public DbAnnouncement(int objectType,
                      long objectID,
                      long userID)

DbAnnouncement

public DbAnnouncement()
Constructor for internal use only.

Method Detail

readExternal

public void readExternal(java.io.DataInput in)
                  throws java.io.IOException
Specified by:
readExternal in interface com.tangosol.io.ExternalizableLite
Throws:
java.io.IOException

writeExternal

public void writeExternal(java.io.DataOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface com.tangosol.io.ExternalizableLite
Throws:
java.io.IOException

getID

public long getID()
Description copied from interface: Announcement
Returns the unique ID of the announcement, or -1 if the announcement hasn't been added to the database yet.

Specified by:
getID in interface Announcement
Returns:
the ID of the announcement.

getContainerObjectType

public int getContainerObjectType()
Description copied from interface: Announcement
Returns the object type of the announcement container. The type must be one of the following:

Specified by:
getContainerObjectType in interface Announcement
Returns:
the object type of the announcement container.

getContainerObjectID

public long getContainerObjectID()
Description copied from interface: Announcement
Returns the object ID of the announcement container. In the case of the container being the system, the object ID is -1.

Specified by:
getContainerObjectID in interface Announcement
Returns:
the ID of the announcement container.

getUser

public User getUser()
Description copied from interface: Announcement
Returns the User that is the author of the announcemnt.

Specified by:
getUser in interface Announcement
Returns:
the author of the announement.

getStartDate

public java.util.Date getStartDate()
Description copied from interface: Announcement
Returns the date when the announcement should first be visible.

Specified by:
getStartDate in interface Announcement
Returns:
the date when the announcement is first visible.

setStartDate

public void setStartDate(java.util.Date startDate)
Description copied from interface: Announcement
Sets the start date for when the announcement should first be visible.

Specified by:
setStartDate in interface Announcement
Parameters:
startDate - the date the announcement should first be visible.

getEndDate

public java.util.Date getEndDate()
Description copied from interface: Announcement
Returns the date when the announcement should not longer be visible. If the end date is null, the announcement will never end.

Specified by:
getEndDate in interface Announcement
Returns:
the date when the announcement is no longer visible.

setEndDate

public void setEndDate(java.util.Date endDate)
                throws UnauthorizedException
Description copied from interface: Announcement
Sets the date when the announcement should not longer be visible. If the end date is null, the announcement will never end.

Specified by:
setEndDate in interface Announcement
Parameters:
endDate - the date when the announcement is no longer visible.
Throws:
UnauthorizedException - if not allowed to set the end date.

getSubject

public java.lang.String getSubject()
Description copied from interface: Announcement
Returns the announcement subject. If filters are active, the subject returned will be a filtered one. Because filters often provide security functionality, this method is the preferred way to get the subject of an announcement.

Specified by:
getSubject in interface Announcement
Returns:
the subject of this message.

setSubject

public void setSubject(java.lang.String subject)
                throws UnauthorizedException
Description copied from interface: Announcement
Sets the announcement subject.

Specified by:
setSubject in interface Announcement
Parameters:
subject - the subject.
Throws:
UnauthorizedException - if not allowed to set the subject.

getUnfilteredSubject

public java.lang.String getUnfilteredSubject()
Description copied from interface: Announcement
Returns the annoucenment subject, bypassing any active filters. Because filters often provide security, this method should be used with caution. In particular, you should avoid showing unfiltered data in an environment where embedded HTML might be interpreted.

Unfiltered content is necessary for a few reasons. One is when saving content to another persistence mechanism such as an XML format.

Specified by:
getUnfilteredSubject in interface Announcement
Returns:
the subject of this message.

getBody

public java.lang.String getBody()
Description copied from interface: Announcement
Returns the announcement body. If filters are active, the body returned will be a filtered one. Because filters often provide security functionality such as stripping out HTML and Javascript, this method is the preferred way to get the body of an announcement.

Specified by:
getBody in interface Announcement
Returns:
the body of this announcement.

getUnfilteredBody

public java.lang.String getUnfilteredBody()
Description copied from interface: Announcement
Returns the announceement body, bypassing any active filters. Because filters often provide security, this method should be used with caution. In particular, you should avoid showing unfiltered data in an environment where embedded HTML might be interpreted.

Unfiltered content is necessary for a few reasons. One is when saving content to another persistence mechanism such as an XML format.

Specified by:
getUnfilteredBody in interface Announcement
Returns:
the unfiltered body of this announcement.

setBody

public void setBody(java.lang.String body)
             throws UnauthorizedException
Description copied from interface: Announcement
Sets the body of this announcement.

Specified by:
setBody in interface Announcement
Parameters:
body - the body.
Throws:
UnauthorizedException - if not allowed to set the body.

getAttachmentCount

public int getAttachmentCount()
Description copied from interface: Announcement
Returns the number of attachments the announcement has.

Specified by:
getAttachmentCount in interface Announcement
Returns:
the number of attachments the announcement has.

deleteAttachment

public void deleteAttachment(Attachment attachment)
                      throws AttachmentException
Description copied from interface: Announcement
Deletes an attachment that belongs to the announcement. Only administrators or the creator of the announcement are allowed to call this method.

Specified by:
deleteAttachment in interface Announcement
Parameters:
attachment - the attachment to delete.
Throws:
AttachmentException - if there was an error deleting the attachment.

getAttachments

public java.util.Iterator getAttachments()
Description copied from interface: Announcement
Returns an Iterator for all the attachments of the message.

Specified by:
getAttachments in interface Announcement
Returns:
an Iterator for the message's attachments.
See Also:
Attachment

getProperty

public java.lang.String getProperty(java.lang.String name)
Description copied from interface: Announcement
Returns an extended property of the announcement. Each announcement can have an arbitrary number of extended properties. This lets particular skins or filters provide enhanced functionality that is not part of the base interface.

For security reasons, you should enable an HTML filter in case properties contain malicious HTML code.

Specified by:
getProperty in interface Announcement
Parameters:
name - the name of the property to get.
Returns:
the value of the property.

getUnfilteredProperty

public java.lang.String getUnfilteredProperty(java.lang.String name)
Description copied from interface: Announcement
Returns an extended property of the announcement, bypassing any filters. Each announcement can have an arbitrary number of extended properties. This lets particular skins or filters provide enhanced functionality that is not part of the base interface.

Because properties are not filtered before being returned, this method should be used with caution. In particular, you should avoid showing unfiltered data in an environment where embedded HTML might be interpreted.

Specified by:
getUnfilteredProperty in interface Announcement
Parameters:
name - the name of the property to get.
Returns:
the value of the property.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Description copied from interface: Announcement
Sets an extended property of this annoucement. Each announcement can have an arbitrary number of extended properties. This lets particular skins or filters provide enhanced functionality that is not part of the base interface.

Specified by:
setProperty in interface Announcement
Parameters:
name - the name of the property to set.
value - the new value for the property.

deleteProperty

public void deleteProperty(java.lang.String name)
Description copied from interface: Announcement
Deletes an extended property. If the property specified by name does not exist, this method will do nothing.

Specified by:
deleteProperty in interface Announcement
Parameters:
name - the name of the property to delete.

getPropertyNames

public java.util.Iterator getPropertyNames()
Description copied from interface: Announcement
Returns an Iterator for all the names of the extended properties.

Specified by:
getPropertyNames in interface Announcement
Returns:
an Iterator for the names of all extended properties.

getCachedSize

public int getCachedSize()
Description copied from interface: Cacheable
Returns the approximate size of the Object in bytes. The size should be considered to be a best estimate of how much memory the Object occupies and may be based on empirical trials or dynamic calculations.

Specified by:
getCachedSize in interface Cacheable
Returns:
the size of the Object in bytes.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

insertIntoDb

protected void insertIntoDb()

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.