org.blojsom.blog
Class FileBackedBlogCategory

java.lang.Object
  extended byorg.blojsom.blog.BlogCategory
      extended byorg.blojsom.blog.FileBackedBlogCategory
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class FileBackedBlogCategory
extends BlogCategory

FileBackedBlogCategory

Version:
$Id: FileBackedBlogCategory.java,v 1.12 2006/07/05 16:47:51 czarneckid Exp $
Author:
David Czarnecki
See Also:
Serialized Form

Field Summary
protected  BlogUser _blogUser
           
 
Fields inherited from class org.blojsom.blog.BlogCategory
_blogEntry, _category, _categoryURL, _description, _metadata, _name, _parentCategory, _subcategories
 
Constructor Summary
FileBackedBlogCategory()
          Create a new FileBackedBlogCategory.
FileBackedBlogCategory(java.lang.String category, java.lang.String categoryURL)
          Create a new FileBackedBlogCategory.
 
Method Summary
 int countBlogEntries(Blog blog, boolean recursive)
          Count the number of blog entries in this category.
 void delete(Blog blog)
          Deprecated.  
 void delete(BlogUser blogUser)
          Delete the blog category.
 java.util.List getSubcategories()
          Return a list of sub-categories under the current category
 java.util.List getSubcategories(int depth)
          Retrieve a list of sub-categories under the current category up to a certain depth
 void load(Blog blog)
          Deprecated.  
 void load(BlogUser blogUser)
          Load a blog category.
protected  void loadMetaData(java.lang.String blogHome, java.lang.String[] propertiesExtensions)
          Load the meta data for the category
protected  int recursiveBlogEntriesCounter(Blog blog, boolean recursive, java.lang.String rootDirectory)
          Recursively count the blog entries in a blog directory
protected  void recursiveCategoryBuilder(BlogUser blogUser, int blogDepth, int blogDirectoryDepth, java.lang.String blogDirectory, java.util.List categoryList)
          Build a list of blog categories recursively
 void save(Blog blog)
          Deprecated.  
 void save(BlogUser blogUser)
          Save the blog category.
 
Methods inherited from class org.blojsom.blog.BlogCategory
compareTo, equals, getCategory, getCategoryURL, getDescription, getEncodedCategory, getEncodedCategoryURL, getMetaData, getName, getParentCategory, setAttributes, setCategory, setCategoryURL, setDescription, setMetaData, setMetaData, setName, setParentCategory, setSubcategories, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_blogUser

protected transient BlogUser _blogUser
Constructor Detail

FileBackedBlogCategory

public FileBackedBlogCategory()
Create a new FileBackedBlogCategory.


FileBackedBlogCategory

public FileBackedBlogCategory(java.lang.String category,
                              java.lang.String categoryURL)
Create a new FileBackedBlogCategory.

Parameters:
category - Category name
categoryURL - Category URL
Method Detail

loadMetaData

protected void loadMetaData(java.lang.String blogHome,
                            java.lang.String[] propertiesExtensions)
Load the meta data for the category

Parameters:
blogHome - Directory where blog entries are stored
propertiesExtensions - List of file extensions to use when looking for category properties

load

public void load(Blog blog)
          throws BlojsomException
Deprecated.  

Load a blog category.

Specified by:
load in class BlogCategory
Parameters:
blog - Blog
Throws:
BlojsomException - If there is an error loading the category
Since:
blojsom 1.9.1

save

public void save(Blog blog)
          throws BlojsomException
Deprecated.  

Save the blog category.

Specified by:
save in class BlogCategory
Parameters:
blog - Blog
Throws:
BlojsomException - If there is an error saving the category
Since:
blojsom 1.9.1

delete

public void delete(Blog blog)
            throws BlojsomException
Deprecated.  

Delete the blog category.

Specified by:
delete in class BlogCategory
Parameters:
blog - Blog
Throws:
BlojsomException - If there is an error deleting the category
Since:
blojsom 1.9.1

load

public void load(BlogUser blogUser)
          throws BlojsomException
Load a blog category. Currently only loads the blog meta-data from disk.

Specified by:
load in class BlogCategory
Parameters:
blogUser - BlogUser
Throws:
BlojsomException - If there is an error loading the category
Since:
blojsom 2.22

save

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

Specified by:
save in class BlogCategory
Parameters:
blogUser - BlogUser
Throws:
BlojsomException - If there is an error saving the category
Since:
blojsom 2.22

delete

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

Specified by:
delete in class BlogCategory
Parameters:
blogUser - BlogUser
Throws:
BlojsomException - If there is an error deleting the category
Since:
blojsom 2.22

recursiveBlogEntriesCounter

protected int recursiveBlogEntriesCounter(Blog blog,
                                          boolean recursive,
                                          java.lang.String rootDirectory)
Recursively count the blog entries in a blog directory

Parameters:
blog - Blog
recursive - Set to true if entries in sub-categories should be counted
rootDirectory -
Returns:

countBlogEntries

public int countBlogEntries(Blog blog,
                            boolean recursive)
Count the number of blog entries in this category. If recursive is true, the method will also count entries in all sub-categories.

Specified by:
countBlogEntries in class BlogCategory
Parameters:
blog - Blog
recursive - Set to true if entries in sub-categories should be counted
Returns:
Number of blog entries in this category
Since:
blojsom 2.22

recursiveCategoryBuilder

protected void recursiveCategoryBuilder(BlogUser blogUser,
                                        int blogDepth,
                                        int blogDirectoryDepth,
                                        java.lang.String blogDirectory,
                                        java.util.List categoryList)
Build a list of blog categories recursively

Parameters:
blogUser - BlogUser
blogDepth - Depth at which the current iteration is running
blogDirectoryDepth - Depth to which the fetcher should stop looking for categories
blogDirectory - Directory in which the current iteration is running
categoryList - Dynamic list of categories that gets added to as it explores directories

getSubcategories

public java.util.List getSubcategories()
Return a list of sub-categories under the current category

Overrides:
getSubcategories in class BlogCategory
Returns:
List of sub-categories as BlogCategory objects
Since:
blojsom 2.22

getSubcategories

public java.util.List getSubcategories(int depth)
Retrieve a list of sub-categories under the current category up to a certain depth

Overrides:
getSubcategories in class BlogCategory
Parameters:
depth - Depth of sub-categories to retrieve, use -1 for all sub-categories
Returns:
@link List} of sub-categories as BlogCategory objects
Since:
blojsom 2.26