Clearspace API (1.7.0) Core Javadocs

com.jivesoftware.community
Interface Announcement

All Superinterfaces:
JiveObject

public interface Announcement
extends JiveObject

Alerts users to important information. Announcements belong to either communities or the system. Each announement has an optional start date and end date; outside of those dates, the announcement will not be displayed to end users.

Each announcement can have an arbitrary number of extended properties, which allow extra data about the announcement to be stored.


Method Summary
 void deleteAttachment(Attachment attachment)
          Deletes an attachment that belongs to the announcement.
 int getAttachmentCount()
          Returns the number of attachments the announcement has.
 JiveIterator<Attachment> getAttachments()
          Returns an Iterable for all the attachments of the message.
 java.lang.String getBody()
          Returns the announcement body.
 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.
 java.util.Map<java.lang.String,java.lang.String> getProperties()
          Retrieve a map of all the extended properties for the announcement.
 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.
 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 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.
 
Methods inherited from interface com.jivesoftware.community.JiveObject
getID, getObjectType
 

Method Detail

getContainerObjectType

int getContainerObjectType()
Returns the object type of the announcement container. The type must be one of the following:

Returns:
the object type of the announcement container.

getContainerObjectID

long getContainerObjectID()
Returns the object ID of the announcement container. In the case of the container being the system, the object ID is -1.

Returns:
the ID of the announcement container.

getUser

User getUser()
Returns the User that is the author of the announcemnt.

Returns:
the author of the announement.

getStartDate

java.util.Date getStartDate()
Returns the date when the announcement should first be visible.

Returns:
the date when the announcement is first visible.

setStartDate

void setStartDate(java.util.Date startDate)
                  throws UnauthorizedException
Sets the start date for when the announcement should first be visible.

Parameters:
startDate - the date the announcement should first be visible.
Throws:
UnauthorizedException - if not allowed to set the start date.

getEndDate

java.util.Date getEndDate()
Returns the date when the announcement should not longer be visible. If the end date is null, the announcement will never end.

Returns:
the date when the announcement is no longer visible.

setEndDate

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

Parameters:
endDate - the date when the announcement is no longer visible.
Throws:
UnauthorizedException - if not allowed to set the end date.

getSubject

java.lang.String getSubject()
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.

Returns:
the subject of this message.

setSubject

void setSubject(java.lang.String subject)
                throws UnauthorizedException
Sets the announcement subject.

Parameters:
subject - the subject.
Throws:
UnauthorizedException - if not allowed to set the subject.

getUnfilteredSubject

java.lang.String getUnfilteredSubject()
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.

Returns:
the subject of this message.

getBody

java.lang.String getBody()
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.

Returns:
the body of this announcement.

setBody

void setBody(java.lang.String body)
             throws UnauthorizedException
Sets the body of this announcement.

Parameters:
body - the body.
Throws:
UnauthorizedException - if not allowed to set the body.

getUnfilteredBody

java.lang.String getUnfilteredBody()
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.

Returns:
the unfiltered body of this announcement.

getAttachmentCount

int getAttachmentCount()
Returns the number of attachments the announcement has.

Returns:
the number of attachments the announcement has.

deleteAttachment

void deleteAttachment(Attachment attachment)
                      throws AttachmentException,
                             UnauthorizedException
Deletes an attachment that belongs to the announcement. Only administrators or the creator of the announcement are allowed to call this method.

Parameters:
attachment - the attachment to delete.
Throws:
java.lang.IllegalArgumentException - if the attachment doesn't belong to the announcement.
UnauthorizedException - if not authorized to delete the attachment.
AttachmentException - if there was an error deleting the attachment.

getAttachments

JiveIterator<Attachment> getAttachments()
Returns an Iterable for all the attachments of the message.

Returns:
an Iterable for the message's attachments.
See Also:
Attachment

getProperties

java.util.Map<java.lang.String,java.lang.String> getProperties()
Retrieve a map of all the extended properties for the announcement. Each announcement can have an arbitrary number of extended properties. This allows for enhanced functionality that is not part of the base interface. The map is alterable if the user is authorized to modify the announcement. Null keys and values are not allowed.

If the user is not authorized to modify the announcement any method which modifies the map will fail with a UnsupportedOperationException;

Returns:
a map of announcement extended properties.

getUnfilteredProperty

java.lang.String getUnfilteredProperty(java.lang.String name)
Returns an extended property of the announcement, bypassing any filters. Each announcement can have an arbitrary number of extended properties. This allows for 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.

Parameters:
name - the name of the property to get.
Returns:
the value of the property.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.