org.apache.aries.samples.blog.persistence.jdbc
Class BlogPersistenceServiceImpl

java.lang.Object
  extended by org.apache.aries.samples.blog.persistence.jdbc.BlogPersistenceServiceImpl
All Implemented Interfaces:
BlogPersistenceService

public class BlogPersistenceServiceImpl
extends Object
implements BlogPersistenceService

This class is the implementation of the blogPersistenceService


Constructor Summary
BlogPersistenceServiceImpl()
           
 
Method Summary
 void createAuthor(String email, Date dob, String name, String displayName, String bio)
          Create an author record
 void createBlogPost(String authorEmail, String title, String blogText, List<String> tags)
          Create a blog entry record
 void destroy()
           
 EntryImpl findBlogEntryByTitle(String title)
          Find the blog entry record with the specified title
 List<AuthorImpl> getAllAuthors()
          Return all author records in the Author table
 List<EntryImpl> getAllBlogEntries()
          Return all blog entry records from BlogEntry table with the most recent published blog entries first
 AuthorImpl getAuthor(String emailAddress)
          Return the author with the specified email address
 List<EntryImpl> getBlogEntries(int firstPostIndex, int noOfPosts)
          Return the portion of blog Entries
 List<EntryImpl> getBlogEntriesModifiedBetween(Date start, Date end)
          Return the blog entries modified between the date range of [start, end]
 EntryImpl getBlogEntryById(long postId)
          Return the blog entry record with the specified id
 List<EntryImpl> getBlogsForAuthor(String emailAddress)
          Return a list of blog entries belonging to the author with the specified email address
 int getNoOfBlogEntries()
          Return the number of the blog entry records
 void init()
           
 void removeAuthor(String emailAddress)
          Delete the author record with the specified email address
 void removeBlogEntry(long id)
          Delete the blog entry record specified by the blogEntry
 void setDataSource(DataSource dataSource)
          set data source
 void updateAuthor(String email, Date dob, String name, String displayName, String bio)
          Update the author record
 void updateBlogEntry(long id, String email, String title, String blogText, List<String> tags, Date updatedDate)
          Update the blog entry record
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlogPersistenceServiceImpl

public BlogPersistenceServiceImpl()
Method Detail

setDataSource

public void setDataSource(DataSource dataSource)
set data source


init

public void init()

destroy

public void destroy()

createAuthor

public void createAuthor(String email,
                         Date dob,
                         String name,
                         String displayName,
                         String bio)
Create an author record

Specified by:
createAuthor in interface BlogPersistenceService
Parameters:
a - The author object to be created
Throws:
ParseException
ParseException

createBlogPost

public void createBlogPost(String authorEmail,
                           String title,
                           String blogText,
                           List<String> tags)
Create a blog entry record

Specified by:
createBlogPost in interface BlogPersistenceService
Parameters:
a - The author
title - The title of the post
blogText - The text of the post
tags -

findBlogEntryByTitle

public EntryImpl findBlogEntryByTitle(String title)
Find the blog entry record with the specified title

Specified by:
findBlogEntryByTitle in interface BlogPersistenceService
Parameters:
The - title to be searched
Returns:
The blogEntry record

getAllAuthors

public List<AuthorImpl> getAllAuthors()
Return all author records in the Author table

Specified by:
getAllAuthors in interface BlogPersistenceService
Returns:
the list of Author records

getAllBlogEntries

public List<EntryImpl> getAllBlogEntries()
Return all blog entry records from BlogEntry table with the most recent published blog entries first

Specified by:
getAllBlogEntries in interface BlogPersistenceService
Returns:
a list of blogEntry object

getNoOfBlogEntries

public int getNoOfBlogEntries()
Return the number of the blog entry records

Specified by:
getNoOfBlogEntries in interface BlogPersistenceService
Returns:
the number of the blog Entry records

getBlogEntries

public List<EntryImpl> getBlogEntries(int firstPostIndex,
                                      int noOfPosts)
Return the portion of blog Entries

Specified by:
getBlogEntries in interface BlogPersistenceService
Parameters:
firstPostIndex - The index of the first blog entry to be returned
noOfPosts - The number of blog entry to be returned
Returns:
The list of the blog entry record

getAuthor

public AuthorImpl getAuthor(String emailAddress)
Return the author with the specified email address

Specified by:
getAuthor in interface BlogPersistenceService
Parameters:
emailAddress - The email address
Returns:
The author record

getBlogEntriesModifiedBetween

public List<EntryImpl> getBlogEntriesModifiedBetween(Date start,
                                                     Date end)
Return the blog entries modified between the date range of [start, end]

Specified by:
getBlogEntriesModifiedBetween in interface BlogPersistenceService
Parameters:
start - The start date
end - The end date
Returns:
The list of blog entries

getBlogsForAuthor

public List<EntryImpl> getBlogsForAuthor(String emailAddress)
Return a list of blog entries belonging to the author with the specified email address

Specified by:
getBlogsForAuthor in interface BlogPersistenceService
Parameters:
emailAddress - the author's email address
Returns:
The list of blog entries

updateAuthor

public void updateAuthor(String email,
                         Date dob,
                         String name,
                         String displayName,
                         String bio)
Update the author record

Specified by:
updateAuthor in interface BlogPersistenceService
Parameters:
email - The email associated with an author
dob - The author's date of birth
name - the author's name
displayName - The displayName
bio - The aouthor's bio

updateBlogEntry

public void updateBlogEntry(long id,
                            String email,
                            String title,
                            String blogText,
                            List<String> tags,
                            Date updatedDate)
Update the blog entry record

Specified by:
updateBlogEntry in interface BlogPersistenceService

removeAuthor

public void removeAuthor(String emailAddress)
Delete the author record with the specified email address

Specified by:
removeAuthor in interface BlogPersistenceService
Parameters:
emailAddress - The author's email address

removeBlogEntry

public void removeBlogEntry(long id)
Delete the blog entry record specified by the blogEntry

Specified by:
removeBlogEntry in interface BlogPersistenceService
Parameters:
blogEntry - the blog entry record to be deleted

getBlogEntryById

public EntryImpl getBlogEntryById(long postId)
Return the blog entry record with the specified id

Specified by:
getBlogEntryById in interface BlogPersistenceService
Parameters:
postId - The blogEntry record id


Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.