Clearspace API (1.10.16) Core Javadocs

com.jivesoftware.community
Interface BlogPost

All Superinterfaces:
AttachmentContentResource, ImageContentResource, JiveContentObject, JiveObject

public interface BlogPost
extends JiveContentObject, AttachmentContentResource, ImageContentResource

A container for blog post data and for a hierarchy of blog comments.

There are two options for navigating through the comments on a post.


Field Summary
static int STATUS_DEFAULT
          The default public status for a blog post.
static int STATUS_DRAFT
          Status value for blog posts that have been saved to the system but haven't been published and shouldn't be viewable to the public.
static int STATUS_PUBLISH
          Status value for blog posts that have been published to the system and should be viewable to the public.
static int STATUS_SCHEDULED
          Status value for blog posts that have been scheduled for publication in the future and shouldn't be viewable to the public.
static boolean TRACKBACKS_DEFAULT
          The default trackback status for a blog post.
 
Fields inherited from interface com.jivesoftware.community.JiveContentObject
BODY_FIELD, SUBJECT_FIELD
 
Method Summary
 Blog getBlog()
          Returns the blog this post belongs to.
 java.lang.String getBody()
          Returns the post body.
 com.jivesoftware.community.CommentDelegator getCommentDelegator()
          Retrieve a comment manager to manage blog post comments.
 int getCommentStatus()
          Returns the comment status of this blog post which may be any one of the following: NONE -- no comments allowed OPEN -- comments are permitted CLOSED -- comments were permitted but are not allowed now Defaults to OPEN.
 java.util.Date getCreationDate()
          Returns the date that this post was created.
 long getID()
          Returns the unique ID of this post, or -1 if the post hasn't been added to the database yet.
 java.util.Date getModificationDate()
          Returns the date that this post was last modified.
 BlogPost getNextPost()
          Returns the next blogpost that has been published or null if this is the most recent post.
 java.lang.String getPermalink()
          Returns the permalink for this post, where the permalink is a composed only of unreserved characters: unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" as according to RFC 3986: http://www.ietf.org/rfc/rfc3986.txt Space characters and characters not in the list of unreserved characters are replaced with a hyphen character.
 BlogPost getPreviousPost()
          Returns the previous blogpost that has been published or null if this is the first post.
 java.util.Map<java.lang.String,java.lang.String> getProperties()
          Retrieve a map of all the extended properties for the post.
 java.util.Date getPublishDate()
          Returns that date that this post should be published.
 com.jivesoftware.community.RatingDelegator getRatingDelegator()
          Retrieve a rating delegator to manage blog post ratings.
 int getStatus()
          Returns the status of this blog post which may be any one of the following: PENDING_APPROVAL -- post has status of unpublished PUBLISH -- post has status of published.
 java.lang.String getSubject()
          Returns the blog post subject.
 com.jivesoftware.community.TagDelegator getTagDelegator()
          Retrieve a tag delegator to manage blog post tags.
 TrackbackManager getTrackbackManager()
          Retrieve a trackback manager to manage blog post trackbacks.
 java.lang.String getUnfilteredProperty(java.lang.String name)
          Returns an extended property of the blog, bypassing any filters.
 User getUser()
          Returns the User that authored this post.
 int getViewCount()
          Returns the number of times this blog post has been viewed.
 boolean isTrackbacksEnabled()
          Returns true if trackbacks are accepted on this blog post, false if not.
 void save()
          Saves the state of this BlogPost to the database
 void setBody(java.lang.String body)
          Sets the body of this post.
 void setCommentStatus(int status)
          Sets the comment status of this blog post which may be any one of the following: NONE -- no comments allowed OPEN -- comments are permitted CLOSED -- comments were permitted but are not allowed now
 void setCreationDate(java.util.Date creationDate)
          Sets the creation date of this post.
 void setModificationDate(java.util.Date modificationDate)
          Sets the date this post was last modified.
 void setPublishDate(java.util.Date publishDate)
          Sets the publish date of this post.
 void setStatus(int status)
          Sets the publishing status of this blog post which may be any one of the following: PENDING_APPROVAL -- post has status of unpublished PUBLISH -- post has status of published.
 void setSubject(java.lang.String subject)
          Sets the subject of this blog post.
 void setTrackbacksEnabled(boolean enable)
          Enables and disables trackbacks for this blog post.
 
Methods inherited from interface com.jivesoftware.community.JiveContentObject
getIndexContent, getPlainBody, getPlainSubject, getUnfilteredBody, getUnfilteredSubject
 
Methods inherited from interface com.jivesoftware.community.JiveObject
getObjectType
 
Methods inherited from interface com.jivesoftware.community.AttachmentContentResource
createAttachment, deleteAttachment, getAttachment, getAttachmentCount, getAttachments
 
Methods inherited from interface com.jivesoftware.community.ImageContentResource
addImage, createImage, deleteImage, getImage, getImageCount, getImages
 

Field Detail

STATUS_DRAFT

static final int STATUS_DRAFT
Status value for blog posts that have been saved to the system but haven't been published and shouldn't be viewable to the public.

See Also:
Constant Field Values

STATUS_PUBLISH

static final int STATUS_PUBLISH
Status value for blog posts that have been published to the system and should be viewable to the public.

See Also:
Constant Field Values

STATUS_SCHEDULED

static final int STATUS_SCHEDULED
Status value for blog posts that have been scheduled for publication in the future and shouldn't be viewable to the public.

See Also:
Constant Field Values

STATUS_DEFAULT

static final int STATUS_DEFAULT
The default public status for a blog post.

See Also:
Constant Field Values

TRACKBACKS_DEFAULT

static final boolean TRACKBACKS_DEFAULT
The default trackback status for a blog post.

See Also:
Constant Field Values
Method Detail

getID

long getID()
Returns the unique ID of this post, or -1 if the post hasn't been added to the database yet.

Specified by:
getID in interface JiveObject
Returns:
the unique ID of the post.

getCreationDate

java.util.Date getCreationDate()
Returns the date that this post was created.

Specified by:
getCreationDate in interface JiveContentObject
Returns:
the date this post was created.

setCreationDate

void setCreationDate(java.util.Date creationDate)
                     throws UnauthorizedException
Sets the creation date of this post. In most cases, the creation date will default to when the post was entered into the system. However, the creation date needs to be set manually when importing data. In other words, skin authors should ignore this method since it only intended for system maintenance.

Parameters:
creationDate - the date this post was created.
Throws:
UnauthorizedException - if not an administrator.

getPublishDate

java.util.Date getPublishDate()
Returns that date that this post should be published.

Returns:
the date this post should be published.

setPublishDate

void setPublishDate(java.util.Date publishDate)
                    throws UnauthorizedException
Sets the publish date of this post. In most cases, the publish date will be the date that the post was initially created. However, if the user chooses, he / she can provide a date in the future or in the past to allow for future publishing or post dating.

Parameters:
publishDate - the date this post should be published.
Throws:
UnauthorizedException - if not allowed to edit this blog post.

getModificationDate

java.util.Date getModificationDate()
Returns the date that this post was last modified.

Specified by:
getModificationDate in interface JiveContentObject
Returns:
the date this post was last modified.

setModificationDate

void setModificationDate(java.util.Date modificationDate)
                         throws UnauthorizedException
Sets the date this post was last modified. In most cases, last modifed will default to when the post data was last changed. However, the last modified date needs to be set manually when importing data. In other words, skin authors should ignore this method since it only intended for system maintenance.

Parameters:
modificationDate - the date this post was modified.
Throws:
UnauthorizedException - if not an administrator.

getStatus

int getStatus()
Returns the status of this blog post which may be any one of the following: Defaults to PENDING_APPROVAL.

Returns:
the publish status of this blog post

setStatus

void setStatus(int status)
               throws UnauthorizedException
Sets the publishing status of this blog post which may be any one of the following:

Parameters:
status - the publish status of this blog post
Throws:
UnauthorizedException - if not allowed to edit this blog post.

getBlog

Blog getBlog()
Returns the blog this post belongs to.

Returns:
the blog this post belongs to.

getSubject

java.lang.String getSubject()
Returns the blog post subject. If system 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 a blog post.

Specified by:
getSubject in interface JiveContentObject
Returns:
the subject of this blog post.

setSubject

void setSubject(java.lang.String subject)
                throws UnauthorizedException
Sets the subject of this blog post.

Parameters:
subject - the subject of this blog post.
Throws:
UnauthorizedException - if not allowed to edit this blog post.

getPermalink

java.lang.String getPermalink()
Returns the permalink for this post, where the permalink is a composed only of unreserved characters:

unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"

as according to RFC 3986: http://www.ietf.org/rfc/rfc3986.txt

Space characters and characters not in the list of unreserved characters are replaced with a hyphen character.

If an entry is composed entirely of spaces or characters not in the list of unreserved characters, the permalink will instead be the ID of the blog post from getID(). Examples:

NOTES:

Returns:
the permalink for this post

getBody

java.lang.String getBody()
Returns the post body. If post 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 a post.

Specified by:
getBody in interface JiveContentObject
Returns:
the body of this blog post.

setBody

void setBody(java.lang.String body)
             throws UnauthorizedException
Sets the body of this post. If body is larger than message.maxBodySize the body will be truncated.

Parameters:
body - the body of this post.
Throws:
UnauthorizedException - if not allowed to edit this blog post.

getUser

User getUser()
Returns the User that authored this post.

Specified by:
getUser in interface JiveContentObject
Returns:
the author of the post.

getPreviousPost

BlogPost getPreviousPost()
                         throws BlogPostNotFoundException
Returns the previous blogpost that has been published or null if this is the first post.

Returns:
blogpost the previous blog post in this blog
Throws:
BlogPostNotFoundException - if the previous blog post could not be loaded

getNextPost

BlogPost getNextPost()
                     throws BlogPostNotFoundException
Returns the next blogpost that has been published or null if this is the most recent post.

Returns:
blogpost the next blog post in this blog
Throws:
BlogPostNotFoundException - if the next blog post could not be loaded

getCommentStatus

int getCommentStatus()
Returns the comment status of this blog post which may be any one of the following: Defaults to OPEN.

Returns:
status the comment status of this blog post

setCommentStatus

void setCommentStatus(int status)
                      throws UnauthorizedException
Sets the comment status of this blog post which may be any one of the following:

Parameters:
status - the comment status of this blog post
Throws:
UnauthorizedException - if not allowed to edit this blog post.

getCommentDelegator

com.jivesoftware.community.CommentDelegator getCommentDelegator()
Retrieve a comment manager to manage blog post comments. Attempting to retrieve a comment manager prior to the blog post being saved will result in an IllegalStateArgument being thrown.

Returns:
a comment manager to manage blog post comments.

isTrackbacksEnabled

boolean isTrackbacksEnabled()
Returns true if trackbacks are accepted on this blog post, false if not. Default is true.

Returns:
true if trackbacks are accepted on this blog post, false if not.

setTrackbacksEnabled

void setTrackbacksEnabled(boolean enable)
Enables and disables trackbacks for this blog post. Default is true.

Parameters:
enable - true to enable trackbacks, false to disable trackbacks

getTrackbackManager

TrackbackManager getTrackbackManager()
Retrieve a trackback manager to manage blog post trackbacks. Attempting to retrieve a trackback manager prior to the blog post being saved will result in an IllegalStateException being thrown.

Returns:
a trackback manager to manage blog post trackbacks.

getTagDelegator

com.jivesoftware.community.TagDelegator getTagDelegator()
Retrieve a tag delegator to manage blog post tags. Attempting to retrieve a tag delegator prior to the blog post being saved will result in an IllegalStateArgument being thrown.

Returns:
a tag delegator to manage blog post tags.

getRatingDelegator

com.jivesoftware.community.RatingDelegator getRatingDelegator()
Retrieve a rating delegator to manage blog post ratings. Attempting to retrieve a rating delegator prior to the blog post being saved will result in an IllegalStateArgument being thrown.

Returns:
a rating delegator to manage blog post ratings.

getProperties

java.util.Map<java.lang.String,java.lang.String> getProperties()
Retrieve a map of all the extended properties for the post. Each post 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 post, however only a mapping of key -> value is allowed. Null keys and values are not allowed.

Values returned from the map are filtered through the filter system. To retrieve unfiltered property values use the getUnfilteredProperty(String) method.

Returns:
a map of post extended properties.

getUnfilteredProperty

java.lang.String getUnfilteredProperty(java.lang.String name)
Returns an extended property of the blog, bypassing any filters. Each blog 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.

save

void save()
          throws UnauthorizedException
Saves the state of this BlogPost to the database

Throws:
UnauthorizedException - If the user is not allowed to modify this blogpost
java.lang.IllegalArgumentException - if the subject has already been used on this blog on the given publish date

getViewCount

int getViewCount()
Returns the number of times this blog post has been viewed. A return value of -1 indicates the number of views is unknown or that the feature is disabled.

Returns:
the number of times this blog post has been viewed or -1 if the value is not known.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.