org.blojsom.blog.database
Class DatabaseEntry

java.lang.Object
  extended byorg.blojsom.blog.database.DatabaseEntry
All Implemented Interfaces:
Entry, java.io.Serializable

public class DatabaseEntry
extends java.lang.Object
implements Entry, java.io.Serializable

DatabaseEntry

Since:
blojsom 3.0
Version:
$Id: DatabaseEntry.java,v 1.7 2007/01/17 02:35:16 czarneckid Exp $
Author:
David Czarnecki
See Also:
Serialized Form

Field Summary
protected  java.lang.Integer _allowComments
           
protected  java.lang.Integer _allowPingbacks
           
protected  java.lang.Integer _allowTrackbacks
           
protected  java.lang.String _author
           
protected  java.lang.Integer _blogCategoryId
           
protected  java.lang.Integer _blogId
           
protected  Category _category
           
protected  java.util.List _comments
           
protected  java.lang.String _description
           
protected  java.util.Date _entryDate
           
protected  java.lang.Integer _id
           
protected  java.lang.String _link
           
protected  java.util.Map _metaData
           
protected  java.util.Date _modifiedDate
           
protected  java.util.List _pingbacks
           
protected  java.lang.String _postSlug
           
protected  java.lang.String _status
           
protected  java.lang.String _title
           
protected  java.util.List _trackbacks
           
 
Constructor Summary
DatabaseEntry()
          Create a new instance of the database entry
 
Method Summary
 java.lang.Boolean allowsComments()
          Whether or not comments are allowed
 java.lang.Boolean allowsPingbacks()
          Whether or not pingbacks are allowed
 java.lang.Boolean allowsTrackbacks()
          Whether or not trackbacks are allowed
 java.lang.Integer getAllowComments()
          Determines whether or not this blog entry supports comments.
 java.lang.Integer getAllowPingbacks()
          Determines whether or not this blog entry supports pingbacks.
 java.lang.Integer getAllowTrackbacks()
          Determines whether or not this blog entry supports trackbacks.
 java.lang.String getAuthor()
          Get the author
 Category getBlogCategory()
          Get the Category object for this blog entry
 java.lang.Integer getBlogCategoryId()
          Get the blog category ID
 java.lang.Integer getBlogId()
          Get the blog ID
 java.lang.String getCategory()
          Category for the blog entry.
 java.util.List getComments()
          Get the comments
 Comment[] getCommentsAsArray()
          Get the comments as an array of Comment objects
 java.util.Date getDate()
          Date of the blog entry

This value is constructed from the lastModified value of the file

 java.lang.String getDateAsFormat(java.lang.String format)
          Return the blog entry date formatted with a specified date format
 java.lang.String getDateAsFormat(java.lang.String format, java.util.Locale locale)
          Return the blog entry date formatted with a specified date format
 java.lang.String getDescription()
          Description of the blog entry
 java.lang.String getEncodedCategory()
          Return the category name encoded.
 java.lang.String getEncodedPostSlug()
          Get the post slug encoded as UTF-8
 java.lang.String getEscapedDescription()
          Escaped description of the blog entry This method would be used for generating RSS feeds where the <, >, and & characters are escaped
 java.lang.String getEscapedTitle()
          Title for the entry where the <, >, and & characters are escaped
 java.lang.Integer getId()
          Get the entry ID
 java.lang.String getISO8601Date()
          Return an ISO 8601 style date http://www.w3.org/TR/NOTE-datetime
 java.util.Map getMetaData()
          Return meta data for this blog entry.
 java.util.Date getModifiedDate()
          Get the last modified date
 int getNumComments()
          Get the number of comments for this entry
 int getNumPingbacks()
          Get the number of pingbacks for this entry
 int getNumTrackbacks()
          Get the number of trackbacks for this entry
 java.util.List getPingbacks()
          Get the pingbacks for this entry
 Pingback[] getPingbacksAsArray()
          Get the pingbacks as an array of Pingbacks objects
 java.lang.String getPostSlug()
          Get the post slug
 java.util.List getResponses()
          Get the responses (comments, trackbacks, pingbacks)
 java.util.List getResponsesMatchingStatus(java.lang.String status)
          Get the responses (comments, trackbacks, pingbacks) matching some status code
 java.util.List getResponsesNotMatchingStatus(java.lang.String status)
          Get the responses (comments, trackbacks, pingbacks) not matching some status code
 java.lang.String getRFC822Date()
          Return an RFC 822 style date
 java.lang.String getStatus()
          Get the status
 java.lang.String getTitle()
          Title of the blog entry
 java.util.List getTrackbacks()
          Get the trackbacks
 Trackback[] getTrackbacksAsArray()
          Get the trackbacks as an array of Trackback objects
 java.lang.String getUTCDate()
          Return an UTC style date
 void setAllowComments(java.lang.Integer allowComments)
          Set whether comments are allowed
 void setAllowPingbacks(java.lang.Integer allowPingbacks)
          Set whether pingbacks are allowed
 void setAllowTrackbacks(java.lang.Integer allowTrackbacks)
          Set whether trackbacks are allowed
 void setAuthor(java.lang.String author)
          Set the author
 void setBlogCategory(Category blogCategory)
          Set the Category object for this blog entry
 void setBlogCategoryId(java.lang.Integer blogCategoryId)
          Set the blog category ID
 void setBlogId(java.lang.Integer blogId)
          Set the blog ID
 void setComments(java.util.List comments)
          Set the comments for this blog entry.
 void setDate(java.util.Date entryDate)
          Date of this blog entry
 void setDescription(java.lang.String description)
          Set the description for the blog entry
 void setId(java.lang.Integer id)
          Set the entry ID
 void setMetaData(java.util.Map metaData)
          Set the meta-data associated with this blog entry
 void setModifiedDate(java.util.Date modifiedDate)
          Set the last modified date
 void setPingbacks(java.util.List pingbacks)
          Set the pingbacks for this blog entry.
 void setPostSlug(java.lang.String postSlug)
          Set the post slug
 void setStatus(java.lang.String status)
          Set the status
 void setTitle(java.lang.String title)
          Set the title of the blog entry
 void setTrackbacks(java.util.List trackbacks)
          Set the trackbacks for this blog entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_id

protected java.lang.Integer _id

_blogCategoryId

protected java.lang.Integer _blogCategoryId

_blogId

protected java.lang.Integer _blogId

_title

protected java.lang.String _title

_link

protected java.lang.String _link

_description

protected java.lang.String _description

_entryDate

protected java.util.Date _entryDate

_modifiedDate

protected java.util.Date _modifiedDate

_comments

protected java.util.List _comments

_trackbacks

protected java.util.List _trackbacks

_pingbacks

protected java.util.List _pingbacks

_category

protected Category _category

_metaData

protected java.util.Map _metaData

_allowComments

protected java.lang.Integer _allowComments

_allowTrackbacks

protected java.lang.Integer _allowTrackbacks

_allowPingbacks

protected java.lang.Integer _allowPingbacks

_status

protected java.lang.String _status

_author

protected java.lang.String _author

_postSlug

protected java.lang.String _postSlug
Constructor Detail

DatabaseEntry

public DatabaseEntry()
Create a new instance of the database entry

Method Detail

setId

public void setId(java.lang.Integer id)
Set the entry ID

Specified by:
setId in interface Entry
Parameters:
id - Entry ID

getId

public java.lang.Integer getId()
Get the entry ID

Specified by:
getId in interface Entry
Returns:
Entry ID

getBlogCategoryId

public java.lang.Integer getBlogCategoryId()
Get the blog category ID

Specified by:
getBlogCategoryId in interface Entry
Returns:
Blog category ID

setBlogCategoryId

public void setBlogCategoryId(java.lang.Integer blogCategoryId)
Set the blog category ID

Specified by:
setBlogCategoryId in interface Entry
Parameters:
blogCategoryId - Blog category ID

getBlogId

public java.lang.Integer getBlogId()
Get the blog ID

Specified by:
getBlogId in interface Entry
Returns:
Blog ID

setBlogId

public void setBlogId(java.lang.Integer blogId)
Set the blog ID

Specified by:
setBlogId in interface Entry
Parameters:
blogId - Blog ID

getDate

public java.util.Date getDate()
Date of the blog entry

This value is constructed from the lastModified value of the file

Specified by:
getDate in interface Entry
Returns:
Date of the blog entry

setDate

public void setDate(java.util.Date entryDate)
Date of this blog entry

Specified by:
setDate in interface Entry
Parameters:
entryDate - Date of the blog entry

getModifiedDate

public java.util.Date getModifiedDate()
Get the last modified date

Specified by:
getModifiedDate in interface Entry
Returns:
Last modified date

setModifiedDate

public void setModifiedDate(java.util.Date modifiedDate)
Set the last modified date

Specified by:
setModifiedDate in interface Entry
Parameters:
modifiedDate - Last modified date

getRFC822Date

public java.lang.String getRFC822Date()
Return an RFC 822 style date

Specified by:
getRFC822Date in interface Entry
Returns:
Date formatted in RFC 822 format

getUTCDate

public java.lang.String getUTCDate()
Return an UTC style date

Specified by:
getUTCDate in interface Entry
Returns:
Date formatted in UTC format

getISO8601Date

public java.lang.String getISO8601Date()
Return an ISO 8601 style date http://www.w3.org/TR/NOTE-datetime

Specified by:
getISO8601Date in interface Entry
Returns:
Date formatted in ISO 8601 format

getDateAsFormat

public java.lang.String getDateAsFormat(java.lang.String format)
Return the blog entry date formatted with a specified date format

Specified by:
getDateAsFormat in interface Entry
Parameters:
format - Date format
Returns:
null if the entry date or format is null, otherwise returns the entry date formatted to the specified format. If the format is invalid, returns entryDate.toString()

getDateAsFormat

public java.lang.String getDateAsFormat(java.lang.String format,
                                        java.util.Locale locale)
Return the blog entry date formatted with a specified date format

Specified by:
getDateAsFormat in interface Entry
Parameters:
format - Date format
locale - Locale for date formatting
Returns:
null if the entry date or format is null, otherwise returns the entry date formatted to the specified format. If the format is invalid, returns entryDate.toString()

getTitle

public java.lang.String getTitle()
Title of the blog entry

Specified by:
getTitle in interface Entry
Returns:
Blog title

setTitle

public void setTitle(java.lang.String title)
Set the title of the blog entry

Specified by:
setTitle in interface Entry
Parameters:
title - Title for the blog entry

getEscapedTitle

public java.lang.String getEscapedTitle()
Title for the entry where the <, >, and & characters are escaped

Specified by:
getEscapedTitle in interface Entry
Returns:
Escaped entry title

getDescription

public java.lang.String getDescription()
Description of the blog entry

Specified by:
getDescription in interface Entry
Returns:
Blog entry description

getEscapedDescription

public java.lang.String getEscapedDescription()
Escaped description of the blog entry This method would be used for generating RSS feeds where the <, >, and & characters are escaped

Specified by:
getEscapedDescription in interface Entry
Returns:
Blog entry description where &, <, and > have been escaped

setDescription

public void setDescription(java.lang.String description)
Set the description for the blog entry

Specified by:
setDescription in interface Entry
Parameters:
description - Description for the blog entry

getCategory

public java.lang.String getCategory()
Category for the blog entry. This corresponds to the category directory name.

Specified by:
getCategory in interface Entry
Returns:
Blog entry category

getEncodedCategory

public java.lang.String getEncodedCategory()
Return the category name encoded.

Specified by:
getEncodedCategory in interface Entry
Returns:
Category name encoded as UTF-8

getAllowComments

public java.lang.Integer getAllowComments()
Determines whether or not this blog entry supports comments.

Specified by:
getAllowComments in interface Entry
Returns:
true if the blog entry supports comments, false otherwise

getComments

public java.util.List getComments()
Get the comments

Specified by:
getComments in interface Entry
Returns:
List of comments

setComments

public void setComments(java.util.List comments)
Set the comments for this blog entry. The comments must be an List of Comment. This method will not writeback or change the comments on disk.

Specified by:
setComments in interface Entry
Parameters:
comments - Comments for this entry

getCommentsAsArray

public Comment[] getCommentsAsArray()
Get the comments as an array of Comment objects

Specified by:
getCommentsAsArray in interface Entry
Returns:
BlogComment[] array

getNumComments

public int getNumComments()
Get the number of comments for this entry

Specified by:
getNumComments in interface Entry
Returns:
0 if comments is null, or the number of comments otherwise, which could be 0

getAllowTrackbacks

public java.lang.Integer getAllowTrackbacks()
Determines whether or not this blog entry supports trackbacks.

Specified by:
getAllowTrackbacks in interface Entry
Returns:
true if the blog entry supports trackbacks, false otherwise

getTrackbacks

public java.util.List getTrackbacks()
Get the trackbacks

Specified by:
getTrackbacks in interface Entry
Returns:
List of trackbacks

setTrackbacks

public void setTrackbacks(java.util.List trackbacks)
Set the trackbacks for this blog entry. The trackbacks must be an List of Trackback. This method will not writeback or change the trackbacks to disk.

Specified by:
setTrackbacks in interface Entry
Parameters:
trackbacks - Trackbacks for this entry

getTrackbacksAsArray

public Trackback[] getTrackbacksAsArray()
Get the trackbacks as an array of Trackback objects

Specified by:
getTrackbacksAsArray in interface Entry
Returns:
Trackback[] array

getNumTrackbacks

public int getNumTrackbacks()
Get the number of trackbacks for this entry

Specified by:
getNumTrackbacks in interface Entry
Returns:
0 if trackbacks is null, or the number of trackbacks otherwise, which could be 0

getBlogCategory

public Category getBlogCategory()
Get the Category object for this blog entry

Specified by:
getBlogCategory in interface Entry
Returns:
Category object

setBlogCategory

public void setBlogCategory(Category blogCategory)
Set the Category object for this blog entry

Specified by:
setBlogCategory in interface Entry
Parameters:
blogCategory - New Category object

getMetaData

public java.util.Map getMetaData()
Return meta data for this blog entry. This method may return null.

Specified by:
getMetaData in interface Entry
Returns:
Meta data

setMetaData

public void setMetaData(java.util.Map metaData)
Set the meta-data associated with this blog entry

Specified by:
setMetaData in interface Entry
Parameters:
metaData - Meta-data

getAllowPingbacks

public java.lang.Integer getAllowPingbacks()
Determines whether or not this blog entry supports pingbacks.

Specified by:
getAllowPingbacks in interface Entry
Returns:
true if the blog entry supports pingbacks, false otherwise

getPingbacks

public java.util.List getPingbacks()
Get the pingbacks for this entry

Specified by:
getPingbacks in interface Entry
Returns:
List of Pingback

setPingbacks

public void setPingbacks(java.util.List pingbacks)
Set the pingbacks for this blog entry. The pingbacks must be a List of Pingback. This method will not writeback or change the pingbacks to disk.

Specified by:
setPingbacks in interface Entry
Parameters:
pingbacks - Pingbacks for this entry

getPingbacksAsArray

public Pingback[] getPingbacksAsArray()
Get the pingbacks as an array of Pingbacks objects

Specified by:
getPingbacksAsArray in interface Entry
Returns:
Pingback[] array

getNumPingbacks

public int getNumPingbacks()
Get the number of pingbacks for this entry

Specified by:
getNumPingbacks in interface Entry
Returns:
0 if pingbacks is null, or the number of pingbacks otherwise, which could be 0

setAllowComments

public void setAllowComments(java.lang.Integer allowComments)
Set whether comments are allowed

Specified by:
setAllowComments in interface Entry
Parameters:
allowComments - true if comments are allowed, false otherwise

setAllowTrackbacks

public void setAllowTrackbacks(java.lang.Integer allowTrackbacks)
Set whether trackbacks are allowed

Specified by:
setAllowTrackbacks in interface Entry
Parameters:
allowTrackbacks - true if trackbacks are allowed, false otherwise

setAllowPingbacks

public void setAllowPingbacks(java.lang.Integer allowPingbacks)
Set whether pingbacks are allowed

Specified by:
setAllowPingbacks in interface Entry
Parameters:
allowPingbacks - true if pingbacks are allowed, false otherwise

getStatus

public java.lang.String getStatus()
Get the status

Specified by:
getStatus in interface Entry
Returns:
Status

setStatus

public void setStatus(java.lang.String status)
Set the status

Specified by:
setStatus in interface Entry
Parameters:
status - Status

getAuthor

public java.lang.String getAuthor()
Get the author

Specified by:
getAuthor in interface Entry
Returns:
Author

setAuthor

public void setAuthor(java.lang.String author)
Set the author

Specified by:
setAuthor in interface Entry
Parameters:
author - Author

allowsComments

public java.lang.Boolean allowsComments()
Whether or not comments are allowed

Specified by:
allowsComments in interface Entry
Returns:
true if comments are allowed, false otherwise

allowsTrackbacks

public java.lang.Boolean allowsTrackbacks()
Whether or not trackbacks are allowed

Specified by:
allowsTrackbacks in interface Entry
Returns:
true if trackbacks are allowed, false otherwise

allowsPingbacks

public java.lang.Boolean allowsPingbacks()
Whether or not pingbacks are allowed

Specified by:
allowsPingbacks in interface Entry
Returns:
true if pingbacks are allowed, false otherwise

getPostSlug

public java.lang.String getPostSlug()
Get the post slug

Specified by:
getPostSlug in interface Entry
Returns:
Post slug

getEncodedPostSlug

public java.lang.String getEncodedPostSlug()
Get the post slug encoded as UTF-8

Specified by:
getEncodedPostSlug in interface Entry
Returns:
Post slug encoded as UTF-8

setPostSlug

public void setPostSlug(java.lang.String postSlug)
Set the post slug

Specified by:
setPostSlug in interface Entry
Parameters:
postSlug - Post slug

getResponses

public java.util.List getResponses()
Get the responses (comments, trackbacks, pingbacks)

Specified by:
getResponses in interface Entry
Returns:
Responses (comments, trackbacks, pingbacks)

getResponsesMatchingStatus

public java.util.List getResponsesMatchingStatus(java.lang.String status)
Get the responses (comments, trackbacks, pingbacks) matching some status code

Specified by:
getResponsesMatchingStatus in interface Entry
Parameters:
status - Status code
Returns:
Responses (comments, trackbacks, pingbacks) matching some status code

getResponsesNotMatchingStatus

public java.util.List getResponsesNotMatchingStatus(java.lang.String status)
Get the responses (comments, trackbacks, pingbacks) not matching some status code

Specified by:
getResponsesNotMatchingStatus in interface Entry
Parameters:
status - Status code
Returns:
Responses (comments, trackbacks, pingbacks) not matching some status code