org.blojsom.blog
Class BlogEntry

java.lang.Object
  extended byorg.blojsom.blog.BlogEntry
All Implemented Interfaces:
BlojsomConstants, BlojsomMetaDataConstants, java.io.Serializable
Direct Known Subclasses:
FileBackedBlogEntry

public abstract class BlogEntry
extends java.lang.Object
implements BlojsomConstants, BlojsomMetaDataConstants, java.io.Serializable

BlogEntry

Version:
$Id: BlogEntry.java,v 1.17 2006/05/16 19:59:34 czarneckid Exp $
Author:
David Czarnecki
See Also:
Serialized Form

Field Summary
protected  BlogCategory _blogCategory
           
protected  java.lang.String _category
           
protected  java.util.List _comments
           
protected  java.lang.String _description
           
protected  java.util.Date _entryDate
           
protected  java.lang.String _filename
           
protected  long _lastModified
           
protected  java.lang.String _link
           
protected  org.apache.commons.logging.Log _logger
           
protected  java.util.Map _metaData
           
protected  java.util.List _pingbacks
           
protected  java.lang.String _title
           
protected  java.util.List _trackbacks
           
 
Fields inherited from interface org.blojsom.util.BlojsomConstants
ADMINISTRATORS_IP, BLOG_ADMIN_URL_IP, BLOG_ADMINISTRATION_LOCALE_IP, BLOG_AUTHORIZATION_IP, BLOG_BASE_URL_IP, BLOG_BLACKLIST_FILE_IP, BLOG_COMMENTS_DIRECTORY_IP, BLOG_COMMENTS_ENABLED_IP, BLOG_COUNTRY_DEFAULT, BLOG_COUNTRY_IP, BLOG_DEFAULT_CATEGORY_EXCLUSION_MAPPING_IP, BLOG_DEFAULT_CATEGORY_MAPPING_IP, BLOG_DEFAULT_FETCHER, BLOG_DEFAULT_FILE_EXTENSION_IP, BLOG_DEFAULT_FLAVOR_IP, BLOG_DEFAULT_PROPERTIES, BLOG_DEPTH_IP, BLOG_DESCRIPTION_IP, BLOG_DIRECTORY_FILTER_IP, BLOG_EMAIL_ENABLED_IP, BLOG_ENTRIES_DISPLAY_DEFAULT, BLOG_ENTRIES_DISPLAY_IP, BLOG_ENTRY_META_DATA_EXTENSION_IP, BLOG_FILE_ENCODING_IP, BLOG_FILE_EXTENSIONS_IP, BLOG_HOME_IP, BLOG_LANGUAGE_DEFAULT, BLOG_LANGUAGE_IP, BLOG_NAME_IP, BLOG_OWNER, BLOG_OWNER_EMAIL, BLOG_PERMISSIONS_IP, BLOG_PINGBACKS_DIRECTORY_IP, BLOG_PINGBACKS_ENABLED_IP, BLOG_PROPERTIES_EXTENSIONS_IP, BLOG_TRACKBACK_DIRECTORY_IP, BLOG_TRACKBACKS_ENABLED_IP, BLOG_URL_IP, BLOJSOM_ALL_CATEGORIES, BLOJSOM_AUTHORIZATION_PROVIDER_IP, BLOJSOM_BLOG, BLOJSOM_BLOG_HOME_IP, BLOJSOM_BROADCASTER_IP, BLOJSOM_CATEGORIES, BLOJSOM_COMMENTS_ENABLED, BLOJSOM_CONFIGURATION_BASE_DIRECTORY_IP, BLOJSOM_CONFIGURATION_IP, BLOJSOM_DATE, BLOJSOM_DATE_ISO8601, BLOJSOM_DATE_OBJECT, BLOJSOM_DATE_UTC, BLOJSOM_DEFAULT_BROADCASTER, BLOJSOM_DEFAULT_CONFIGURATION_BASE_DIRECTORY, BLOJSOM_DEFAULT_RESOURCE_DIRECTORY, BLOJSOM_DEFAULT_RESOURCE_MANAGER, BLOJSOM_DEFAULT_TEMPLATES_DIRECTORY, BLOJSOM_DEFAULT_USER_IP, BLOJSOM_EMAIL_ENABLED, BLOJSOM_ENTRIES, BLOJSOM_FETCHER_IP, BLOJSOM_FLAVOR_CONFIGURATION_IP, BLOJSOM_INSTALLATION_DIRECTORY_IP, BLOJSOM_INSTALLED_LOCALES_IP, BLOJSOM_LAST_MODIFIED, BLOJSOM_LISTENER_CONFIGURATION_IP, BLOJSOM_PERMALINK, BLOJSOM_PERMALINK_NEXT_ENTRY, BLOJSOM_PERMALINK_PREVIOUS_ENTRY, BLOJSOM_PLUGIN_CHAIN, BLOJSOM_PLUGIN_CONFIGURATION_IP, BLOJSOM_PLUGINS, BLOJSOM_REQUESTED_CATEGORY, BLOJSOM_REQUESTED_FLAVOR, BLOJSOM_RESOURCE_DIRECTORY_IP, BLOJSOM_RESOURCE_MANAGER_BUNDLES_IP, BLOJSOM_RESOURCE_MANAGER_CONTEXT_KEY, BLOJSOM_RESOURCE_MANAGER_IP, BLOJSOM_SITE_URL, BLOJSOM_TEMPLATES_DIRECTORY_IP, BLOJSOM_USER, BLOJSOM_USERS_IP, BLOJSOM_VERSION, BLOJSOM_VERSION_NUMBER, CACHE_CONTROL_HTTP_HEADER, CATEGORY_PARAM, COMMENT_EXTENSION, DEFAULT_AUTHORIZATION_PROVIDER, DEFAULT_COMMENTS_DIRECTORY, DEFAULT_DIGEST_ALGORITHM, DEFAULT_DISPATCHER_CONFIGURATION_FILE, DEFAULT_ENTRY_EXTENSION, DEFAULT_FLAVOR_CONFIGURATION_FILE, DEFAULT_FLAVOR_HTML, DEFAULT_METADATA_EXTENSION, DEFAULT_PERMISSIONS_CONFIGURATION_FILE, DEFAULT_PINGBACKS_DIRECTORY, DEFAULT_PLUGIN_CONFIGURATION_FILE, DEFAULT_PROPERTIES_EXTENSIONS, DEFAULT_TRACKBACK_DIRECTORY, DESCRIPTION_KEY, DIGEST_ALGORITHM, FLAVOR_PARAM, HTTP_ETAG, HTTP_LASTMODIFIED, INFINITE_BLOG_DEPTH, ISO_8601_DATE_FORMAT, LINE_SEPARATOR, LINEAR_NAVIGATION_ENABLED_IP, MAX_HASHABLE_LENGTH, NAME_KEY, NO_CACHE_HTTP_HEADER_VALUE, OVERRIDE_LASTMODIFIED_PARAM, PAGE_PARAM, PAGE_PARAM_ARCHIVE, PERMALINK_PARAM, PINGBACK_EXTENSION, PLUGINS_PARAM, PRAGMA_HTTP_HEADER, PREFERRED_SYNDICATION_FLAVOR, RECURSIVE_CATEGORIES, REDIRECT_TO_PARAM, RFC_822_DATE_FORMAT, SHORT_ISO_8601_DATE_FORMAT, TRACKBACK_EXTENSION, USE_ENCRYPTED_PASSWORDS, UTC_DATE_FORMAT, UTF8, WHITESPACE, XMLRPC_ENABLED_IP
 
Fields inherited from interface org.blojsom.util.BlojsomMetaDataConstants
BLOG_ENTRY_METADATA_AUTHOR, BLOG_ENTRY_METADATA_AUTHOR_EXT, BLOG_ENTRY_METADATA_TIMESTAMP, BLOG_METADATA_COMMENTS_DISABLED, BLOG_METADATA_HEADER, BLOG_METADATA_PINGBACKS_DISABLED, BLOG_METADATA_TRACKBACKS_DISABLED, SOURCE_ATTRIBUTE
 
Constructor Summary
BlogEntry()
          Create a new blog entry with no data
 
Method Summary
abstract  void delete(BlogUser blogUser)
          Delete the blog entry.
 boolean equals(java.lang.Object o)
          Checks to see if the link to this entry is the same as the input entry
 BlogCategory getBlogCategory()
          Get the BlogCategory object for this blog entry
 java.lang.String getCategory()
          Category for the blog entry.
 java.util.List getComments()
          Get the comments
 BlogComment[] getCommentsAsArray()
          Get the comments as an array of BlogComment 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 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 getEscapedLink()
          Permalink for the blog entry where the <, >, and & characters are escaped
 java.lang.String getEscapedTitle()
          Title for the entry where the <, >, and & characters are escaped
 java.lang.String getFilename()
          Filename of the blog entry
abstract  java.lang.String getId()
          Returns the BlogId for this entry
 java.lang.String getISO8601Date()
          Return an ISO 8601 style date http://www.w3.org/TR/NOTE-datetime
 long getLastModified()
          Last modified time for the blog entry
 java.lang.String getLink()
          Permalink for the blog entry
 java.util.Map getMetaData()
          Return meta data for this blog entry.
 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
abstract  java.lang.String getPermalink()
          Return the permalink name for this blog 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 getRFC822Date()
          Return an RFC 822 style date
 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
abstract  void load(BlogUser blogUser)
          Load a blog entry.
abstract  void save(BlogUser blogUser)
          Save the blog entry.
 void setAttributes(java.util.Map attributeMap)
          Set any attributes of the blog entry using data from the map.
 void setBlogCategory(BlogCategory blogCategory)
          Set the BlogCategory object for this blog entry
 void setCategory(java.lang.String category)
          Set the category for the blog entry.
 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 setFilename(java.lang.String filename)
          Set the proposed filename of the blog entry
 void setLink(java.lang.String link)
          Set the permalink for the blog entry
 void setMetaData(java.util.Map metaData)
          Set the meta-data associated with this blog entry
 void setPingbacks(java.util.List pingbacks)
          Set the pingbacks for this blog entry.
 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.
abstract  boolean supportsComments()
          Determines whether or not this blog entry supports comments.
abstract  boolean supportsPingbacks()
          Determines whether or not this blog entry supports pingbacks.
abstract  boolean supportsTrackbacks()
          Determines whether or not this blog entry supports trackbacks.
 java.lang.String toString()
          Return a string representation of the entry.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_logger

protected transient org.apache.commons.logging.Log _logger

_title

protected java.lang.String _title

_link

protected java.lang.String _link

_filename

protected java.lang.String _filename

_description

protected java.lang.String _description

_category

protected java.lang.String _category

_entryDate

protected java.util.Date _entryDate

_lastModified

protected long _lastModified

_comments

protected java.util.List _comments

_trackbacks

protected java.util.List _trackbacks

_pingbacks

protected java.util.List _pingbacks

_blogCategory

protected BlogCategory _blogCategory

_metaData

protected java.util.Map _metaData
Constructor Detail

BlogEntry

public BlogEntry()
Create a new blog entry with no data

Method Detail

getDate

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

This value is constructed from the lastModified value of the file

Returns:
Date of the blog entry

setDate

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

Parameters:
entryDate - Date of the blog entry

getRFC822Date

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

Returns:
Date formatted in RFC 822 format

getUTCDate

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

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

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

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()
Since:
blojsom 1.9.3

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

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()
Since:
blojsom 2.25

getTitle

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

Returns:
Blog title

setTitle

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

Parameters:
title - Title for the blog entry

getEscapedTitle

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

Returns:
Escaped entry title

getFilename

public java.lang.String getFilename()
Filename of the blog entry

Returns:
Blog filename

setFilename

public void setFilename(java.lang.String filename)
Set the proposed filename of the blog entry

Parameters:
filename - Filename for the blog entry

getLink

public java.lang.String getLink()
Permalink for the blog entry

Returns:
Blog entry permalink

getEscapedLink

public java.lang.String getEscapedLink()
Permalink for the blog entry where the <, >, and & characters are escaped

Returns:
Blog entry permalink which has been escaped

setLink

public void setLink(java.lang.String link)
Set the permalink for the blog entry

Parameters:
link - Permalink for the blog entry

getDescription

public java.lang.String getDescription()
Description of the blog 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

Returns:
Blog entry description where &, <, and > have been escaped

setDescription

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

Parameters:
description - Description for the blog entry

getLastModified

public long getLastModified()
Last modified time for the blog entry

Returns:
Blog entry last modified time

getId

public abstract java.lang.String getId()
Returns the BlogId for this entry

Returns:
Blog Id

getPermalink

public abstract java.lang.String getPermalink()
Return the permalink name for this blog entry

Returns:
Permalink name

getCategory

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

Returns:
Blog entry category

getEncodedCategory

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

Returns:
Category name encoded as UTF-8
Since:
blojsom 2.08

setCategory

public void setCategory(java.lang.String category)
Set the category for the blog entry. This corresponds to the category directory name.

Parameters:
category - Category for the blog entry

equals

public boolean equals(java.lang.Object o)
Checks to see if the link to this entry is the same as the input entry

See Also:
Object.equals(java.lang.Object)

supportsComments

public abstract boolean supportsComments()
Determines whether or not this blog entry supports comments.

Returns:
true if the blog entry supports comments, false otherwise

getComments

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

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 BlogComment. This method will not writeback or change the comments on disk.

Parameters:
comments - Comments for this entry

getCommentsAsArray

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

Returns:
BlogComment[] array

getNumComments

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

Returns:
0 if comments is null, or the number of comments otherwise, which could be 0

supportsTrackbacks

public abstract boolean supportsTrackbacks()
Determines whether or not this blog entry supports trackbacks.

Returns:
true if the blog entry supports trackbacks, false otherwise
Since:
blojsom 2.05

getTrackbacks

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

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.

Parameters:
trackbacks - Trackbacks for this entry

getTrackbacksAsArray

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

Returns:
Trackback[] array

getNumTrackbacks

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

Returns:
0 if trackbacks is null, or the number of trackbacks otherwise, which could be 0

getBlogCategory

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

Returns:
BlogCategory object

setBlogCategory

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

Parameters:
blogCategory - New BlogCategory object

getMetaData

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

Returns:
Meta data
Since:
blojsom 1.8

setMetaData

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

Parameters:
metaData - Meta-data
Since:
blojsom 1.8

toString

public java.lang.String toString()
Return a string representation of the entry. The default implementation is to return the blog entry title.

Returns:
String representation of this entry
Since:
blojsom 1.9

setAttributes

public void setAttributes(java.util.Map attributeMap)
Set any attributes of the blog entry using data from the map.

Parameters:
attributeMap - Attributes
Since:
blojsom 1.9

supportsPingbacks

public abstract boolean supportsPingbacks()
Determines whether or not this blog entry supports pingbacks.

Returns:
true if the blog entry supports pingbacks, false otherwise
Since:
blojsom 2.23

getPingbacks

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

Returns:
List of Pingbacks
Since:
blojsom 2.23

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.

Parameters:
pingbacks - Pingbacks for this entry
Since:
blojsom 2.23

getPingbacksAsArray

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

Returns:
Pingback[] array
Since:
blojsom 2.23

getNumPingbacks

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

Returns:
0 if pingbacks is null, or the number of pingbacks otherwise, which could be 0
Since:
blojsom 2.23

load

public abstract void load(BlogUser blogUser)
                   throws BlojsomException
Load a blog entry.

Parameters:
blogUser - User information
Throws:
BlojsomException - If there is an error loading the entry
Since:
blojsom 1.9

save

public abstract void save(BlogUser blogUser)
                   throws BlojsomException
Save the blog entry.

Parameters:
blogUser - User information
Throws:
BlojsomException - If there is an error saving the entry
Since:
blojsom 1.9

delete

public abstract void delete(BlogUser blogUser)
                     throws BlojsomException
Delete the blog entry.

Parameters:
blogUser - User information
Throws:
BlojsomException - If there is an error deleting the entry
Since:
blojsom 1.9