net.sourceforge.pebble.domain
Class BlogEntry

java.lang.Object
  extended by net.sourceforge.pebble.domain.Content
      extended by net.sourceforge.pebble.domain.PageBasedContent
          extended by net.sourceforge.pebble.domain.BlogEntry
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Permalinkable

public class BlogEntry
extends PageBasedContent

Represents a blog entry.

Author:
Simon Brown
See Also:
Serialized Form

Field Summary
static java.lang.String ATTACHMENT_PROPERTY
           
static java.lang.String CATEGORIES_PROPERTY
           
static java.lang.String COMMENTS_ENABLED_PROPERTY
           
static java.lang.String EXCERPT_PROPERTY
           
static java.lang.String TAGS_PROPERTY
           
static java.lang.String TRACKBACKS_ENABLED_PROPERTY
           
 
Fields inherited from class net.sourceforge.pebble.domain.PageBasedContent
AUTHOR_PROPERTY, BODY_PROPERTY, DATE_PROPERTY, ORIGINAL_PERMALINK_PROPERTY, SUBTITLE_PROPERTY, TITLE_PROPERTY
 
Fields inherited from class net.sourceforge.pebble.domain.Content
propertyChangeSupport
 
Constructor Summary
BlogEntry(Blog blog)
          Creates a new blog entry.
 
Method Summary
 void addCategory(Category category)
          Sets the category of this blog entry.
 void addComment(Comment comment)
          Adds the specified comment.
 void addTrackBack(TrackBack trackBack)
          Adds the specified trackback.
 void clearEvents()
           
 java.lang.Object clone()
          Creates and returns a copy of this object.
 Comment createComment(java.lang.String title, java.lang.String body, java.lang.String author, java.lang.String email, java.lang.String website, java.lang.String ipAddress)
          Creates a new comment for this blog entry, with a creation date of now.
 Comment createComment(java.lang.String title, java.lang.String body, java.lang.String author, java.lang.String email, java.lang.String website, java.lang.String ipAddress, java.util.Date date, State state)
          Creates a new comment for this blog entry.
 TrackBack createTrackBack(java.lang.String title, java.lang.String excerpt, java.lang.String url, java.lang.String blogName, java.lang.String ipAddress)
          Creates a new trackback for this blog entry with a date of now.
 TrackBack createTrackBack(java.lang.String title, java.lang.String excerpt, java.lang.String url, java.lang.String blogName, java.lang.String ipAddress, java.util.Date date, State state)
          Creates a new trackback for this blog entry.
 boolean equals(java.lang.Object o)
          Indicates whether some other object is "equal to" this one.
 java.util.List<Tag> getAllTags()
          Gets a list of all tags.
 Attachment getAttachment()
          Gets the attachment associated with this blog entry.
 java.util.Set<Category> getCategories()
          Gets the category of this blog entry.
 Comment getComment(long id)
          Gets the specified comment.
 java.util.List<Comment> getComments()
          Gets a collection of all comments.
 java.lang.String getCommentsLink()
          Gets a link to the comments for this blog entry.
 java.lang.String getContent()
          Gets the content of this response.
 java.lang.String getExcerpt()
          Gets the excerpt of this blog entry.
 java.lang.String getGuid()
           
 java.util.Date getLastModified()
          Gets the date that this blog entry was last updated.
 java.lang.String getLocalPermalink()
          Gets a permalink for this blog entry that is local to the blog.
 BlogEntry getNextBlogEntry()
          Returns the blog entry that was posted after this one.
 int getNumberOfComments()
          Gets the number of comments that have been left for this blog entry.
 int getNumberOfResponses()
          Gets the number of responses that have been left for this blog entry.
 int getNumberOfTrackBacks()
          Gets the number of trackbacks that have been left for this blog entry.
 BlogEntry getPreviousBlogEntry()
          Returns the blog entry that was posted before this one.
 Response getResponse(java.lang.String guid)
          Gets the response specified by the guid.
 java.util.List<Response> getResponses()
          Gets a list of all comments and TrackBacks.
 java.lang.String getTags()
          Gets the tags associated with this category.
 java.util.List<Tag> getTagsAsList()
          Gets the tags associated with this category, as a List.
 java.util.TimeZone getTimeZone()
           
 java.lang.String getTimeZoneId()
           
 TrackBack getTrackBack(long id)
          Gets the specified TrackBack.
 java.lang.String getTrackBackLink()
          Gets the link that blogs can send TrackBacks too.
 java.util.List<TrackBack> getTrackBacks()
          Gets a collection of all trackbacks.
 java.lang.String getTrackBacksLink()
          Gets a link to the trackbacks for this blog entry.
 int hashCode()
           
 boolean hasTag(java.lang.String s)
          Determines whether this blog entry has the specified tag.
 boolean inCategory(Category category)
          Determines whether this blog entry is in the specified category.
 boolean isCommentsEnabled()
          Determines whether comments are enabled for this blog entry.
 boolean isTrackBacksEnabled()
          Determines whether TrackBacks are enabled for this blog entry.
 void removeAllCategories()
          Removes all categories from this blog entry.
 void removeComment(long id)
          Removes the specified comment.
 void removeResponse(Response response)
          Removes the specified comment or TrackBack.
 void removeTrackBack(long id)
          Removes the specified TrackBack.
 void setAttachment(Attachment newAttachment)
          Sets the attachment associated with thie blog entry.
 void setCategories(java.util.Collection newCategories)
          Sets the categories for this blog entry.
 void setCommentsEnabled(boolean newCommentsEnabled)
          Sets whether comments are enabled for this blog entry.
 void setDate(java.util.Date newDate)
          Sets the date that this blog entry was created.
 void setExcerpt(java.lang.String newExcerpt)
          Sets the excerpt of this blog entry.
 void setTags(java.lang.String newTags)
          Sets the set of tags associated with this category.
 void setTimeZoneId(java.lang.String timeZoneId)
           
 void setTitle(java.lang.String newTitle)
          Sets the title of this blog entry.
 void setTrackBacksEnabled(boolean newTrackBacksEnabled)
          Sets whether TrackBacks are enabled for this blog entry.
 java.lang.String toString()
          Gets a string representation of this object.
 void validate(ValidationContext context)
           
 
Methods inherited from class net.sourceforge.pebble.domain.PageBasedContent
getAuthor, getBlog, getBody, getDate, getId, getOriginalPermalink, getPermalink, getSubtitle, getTitle, getUser, isAggregated, isPersistent, isPublished, isUnpublished, setAuthor, setBody, setOriginalPermalink, setPersistent, setPublished, setSubtitle
 
Methods inherited from class net.sourceforge.pebble.domain.Content
clearPropertyChangeEvents, getEvents, getPropertyChangeEvents, getState, getTruncatedContent, hasEvents, isDirty, nextEvent
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EXCERPT_PROPERTY

public static final java.lang.String EXCERPT_PROPERTY
See Also:
Constant Field Values

COMMENTS_ENABLED_PROPERTY

public static final java.lang.String COMMENTS_ENABLED_PROPERTY
See Also:
Constant Field Values

TRACKBACKS_ENABLED_PROPERTY

public static final java.lang.String TRACKBACKS_ENABLED_PROPERTY
See Also:
Constant Field Values

ATTACHMENT_PROPERTY

public static final java.lang.String ATTACHMENT_PROPERTY
See Also:
Constant Field Values

CATEGORIES_PROPERTY

public static final java.lang.String CATEGORIES_PROPERTY
See Also:
Constant Field Values

TAGS_PROPERTY

public static final java.lang.String TAGS_PROPERTY
See Also:
Constant Field Values
Constructor Detail

BlogEntry

public BlogEntry(Blog blog)
Creates a new blog entry.

Parameters:
blog - the owning Blog
Method Detail

setTitle

public void setTitle(java.lang.String newTitle)
Sets the title of this blog entry.

Overrides:
setTitle in class PageBasedContent
Parameters:
newTitle - the title as a String

getCategories

public java.util.Set<Category> getCategories()
Gets the category of this blog entry.

Returns:
the category as a String

getAllTags

public java.util.List<Tag> getAllTags()
Gets a list of all tags.

Returns:
a List of tags

addCategory

public void addCategory(Category category)
Sets the category of this blog entry.

Parameters:
category - the category as a String

removeAllCategories

public void removeAllCategories()
Removes all categories from this blog entry.


setCategories

public void setCategories(java.util.Collection newCategories)
Sets the categories for this blog entry.

Parameters:
newCategories - a Collection of Category instances

inCategory

public boolean inCategory(Category category)
Determines whether this blog entry is in the specified category.

Parameters:
category - a Category instance
Returns:
true if this entry is in the specified category, false otherwise

hasTag

public boolean hasTag(java.lang.String s)
Determines whether this blog entry has the specified tag.

Parameters:
s - a String
Returns:
true if this entry has the specified tag, false otherwise

getTags

public java.lang.String getTags()
Gets the tags associated with this category.

Returns:
a list of tags

getTagsAsList

public java.util.List<Tag> getTagsAsList()
Gets the tags associated with this category, as a List.

Returns:
a List of tags

setTags

public void setTags(java.lang.String newTags)
Sets the set of tags associated with this category.

Parameters:
newTags - a set of tags

getContent

public java.lang.String getContent()
Gets the content of this response.

Overrides:
getContent in class PageBasedContent
Returns:
a String

getExcerpt

public java.lang.String getExcerpt()
Gets the excerpt of this blog entry.

Returns:
the excerpt as a String

setExcerpt

public void setExcerpt(java.lang.String newExcerpt)
Sets the excerpt of this blog entry.

Parameters:
newExcerpt - the excerpt as a String

getLastModified

public java.util.Date getLastModified()
Gets the date that this blog entry was last updated.

Overrides:
getLastModified in class PageBasedContent
Returns:
a Date instance representing the time of the last comment/TrackBack

setDate

public void setDate(java.util.Date newDate)
Sets the date that this blog entry was created.

Overrides:
setDate in class PageBasedContent
Parameters:
newDate - a java.util.Date instance

getLocalPermalink

public java.lang.String getLocalPermalink()
Gets a permalink for this blog entry that is local to the blog. In other words, it doesn't take into account the original permalink for aggregated content.

Specified by:
getLocalPermalink in class PageBasedContent
Returns:
an absolute URL as a String

getAttachment

public Attachment getAttachment()
Gets the attachment associated with this blog entry.

Returns:
an Attachment instance, or null if one doesn't exist

setAttachment

public void setAttachment(Attachment newAttachment)
Sets the attachment associated with thie blog entry.

Parameters:
newAttachment - an Attachment instance

isCommentsEnabled

public boolean isCommentsEnabled()
Determines whether comments are enabled for this blog entry.

Returns:
true if comments are enabled, false otherwise

setCommentsEnabled

public void setCommentsEnabled(boolean newCommentsEnabled)
Sets whether comments are enabled for this blog entry.

Parameters:
newCommentsEnabled - true if comments should be enabled, false otherwise

getCommentsLink

public java.lang.String getCommentsLink()
Gets a link to the comments for this blog entry.

Returns:
an absolute URL as a String

isTrackBacksEnabled

public boolean isTrackBacksEnabled()
Determines whether TrackBacks are enabled for this blog entry.

Returns:
true if TrackBacks are enabled, false otherwise

setTrackBacksEnabled

public void setTrackBacksEnabled(boolean newTrackBacksEnabled)
Sets whether TrackBacks are enabled for this blog entry.

Parameters:
newTrackBacksEnabled - true if TrackBacks should be enabled, false otherwise

getTrackBacksLink

public java.lang.String getTrackBacksLink()
Gets a link to the trackbacks for this blog entry.

Returns:
an absolute URL as a String

getTrackBackLink

public java.lang.String getTrackBackLink()
Gets the link that blogs can send TrackBacks too.


getResponses

public java.util.List<Response> getResponses()
Gets a list of all comments and TrackBacks.

Returns:
a List of all Response instances

getComments

public java.util.List<Comment> getComments()
Gets a collection of all comments.

Returns:
a List of Comment instances

getNumberOfComments

public int getNumberOfComments()
Gets the number of comments that have been left for this blog entry.

Returns:
the number of comments as a int

getTrackBacks

public java.util.List<TrackBack> getTrackBacks()
Gets a collection of all trackbacks.

Returns:
a List of TrackBack instances

getNumberOfTrackBacks

public int getNumberOfTrackBacks()
Gets the number of trackbacks that have been left for this blog entry.

Returns:
the number of trackbacks as a int

getNumberOfResponses

public int getNumberOfResponses()
Gets the number of responses that have been left for this blog entry.

Returns:
the number of responses as a int

createComment

public Comment createComment(java.lang.String title,
                             java.lang.String body,
                             java.lang.String author,
                             java.lang.String email,
                             java.lang.String website,
                             java.lang.String ipAddress,
                             java.util.Date date,
                             State state)
Creates a new comment for this blog entry. This method doesn't actually add the comment too.

Parameters:
title - the title of the comment
body - the body of the comment
author - the author of the comment
email - the author's e-mail address
website - the author's website
ipAddress - the IP address of the author
date - the date that the comment was created
state - the state of the comment
Returns:
a new Comment instance with the specified properties

createComment

public Comment createComment(java.lang.String title,
                             java.lang.String body,
                             java.lang.String author,
                             java.lang.String email,
                             java.lang.String website,
                             java.lang.String ipAddress)
Creates a new comment for this blog entry, with a creation date of now. This method doesn't actually add the comment too.

Parameters:
title - the title of the comment
body - the body of the comment
author - the author of the comment
email - the author's e-mail address
website - the author's website
ipAddress - the IP address of the author
Returns:
a new Comment instance with the specified properties

addComment

public void addComment(Comment comment)
Adds the specified comment.

Parameters:
comment - a Comment instance

createTrackBack

public TrackBack createTrackBack(java.lang.String title,
                                 java.lang.String excerpt,
                                 java.lang.String url,
                                 java.lang.String blogName,
                                 java.lang.String ipAddress,
                                 java.util.Date date,
                                 State state)
Creates a new trackback for this blog entry. This method doesn't actually add the trackback too.

Parameters:
title - the title of the entry
excerpt - the excerpt of the entry
url - the url (permalink) of the entry
blogName - the name of the blog
ipAddress - the IP address of the author
date - the date the trackback was received
Returns:
a new TrackBack instance with the specified properties

createTrackBack

public TrackBack createTrackBack(java.lang.String title,
                                 java.lang.String excerpt,
                                 java.lang.String url,
                                 java.lang.String blogName,
                                 java.lang.String ipAddress)
Creates a new trackback for this blog entry with a date of now. This method doesn't actually add the trackback too.

Parameters:
title - the title of the entry
excerpt - the excerpt of the entry
url - the url (permalink) of the entry
blogName - the name of the blog
ipAddress - the IP address of the author
Returns:
a new Comment instance with the specified properties

addTrackBack

public void addTrackBack(TrackBack trackBack)
Adds the specified trackback.

Parameters:
trackBack - a TrackBack instance

removeComment

public void removeComment(long id)
Removes the specified comment.

Parameters:
id - the id of the comment to be removed

getComment

public Comment getComment(long id)
Gets the specified comment.

Parameters:
id - the id of the comment

getTrackBack

public TrackBack getTrackBack(long id)
Gets the specified TrackBack.

Parameters:
id - the id of the TrackBack

getResponse

public Response getResponse(java.lang.String guid)
Gets the response specified by the guid.

Parameters:
guid - the response guid
Returns:
a Response object, or null if no response exists

removeTrackBack

public void removeTrackBack(long id)
Removes the specified TrackBack.

Parameters:
id - the id of the TrackBack to be removed

removeResponse

public void removeResponse(Response response)
Removes the specified comment or TrackBack.

Parameters:
response - the Response to be removed

getPreviousBlogEntry

public BlogEntry getPreviousBlogEntry()
Returns the blog entry that was posted before this one.

Returns:
a BlogEntry instance, or null if this is the first entry

getNextBlogEntry

public BlogEntry getNextBlogEntry()
Returns the blog entry that was posted after this one.

Returns:
a BlogEntry instance, or null is this is the last entry

validate

public void validate(ValidationContext context)

equals

public boolean equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
hashCode(), Hashtable

getGuid

public java.lang.String getGuid()

hashCode

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

clone

public java.lang.Object clone()
Creates and returns a copy of this object.

Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance.
See Also:
Cloneable

clearEvents

public void clearEvents()

toString

public java.lang.String toString()
Description copied from class: PageBasedContent
Gets a string representation of this object.

Overrides:
toString in class PageBasedContent
Returns:
a String

getTimeZone

public java.util.TimeZone getTimeZone()

getTimeZoneId

public java.lang.String getTimeZoneId()

setTimeZoneId

public void setTimeZoneId(java.lang.String timeZoneId)


Copyright © 2003-2006, Simon Brown. All Rights Reserved.