org.apache.aries.samples.blog.api.persistence
Interface BlogPersistenceService


public interface BlogPersistenceService

This is the interface for the persistence layer of the blog application. This persistence layer is registered in the service registry and is used by the main application layer.


Method Summary
 void createAuthor(String email, Date dob, String name, String displayName, String bio)
          Create an author in the database
 void createBlogPost(String email, String title, String blogText, List<String> tags)
          Create an Blog post in the database
 Entry findBlogEntryByTitle(String title)
          Get a BlogEntry that has a given title
 List<? extends Author> getAllAuthors()
          Get all authors in the database
 List<? extends Entry> getAllBlogEntries()
          Get all the blog entries in the data store
 Author getAuthor(String emailAddress)
          Get the details for an author
 List<? extends Entry> getBlogEntries(int firstPostIndex, int no)
          Get the first N most recent posts starting from post X
 List<? extends Entry> getBlogEntriesModifiedBetween(Date start, Date end)
          Get BlogEntries created or modified between two specified dates
 Entry getBlogEntryById(long postId)
          Obtain a given Blog post using its unique id.
 List<? extends Entry> getBlogsForAuthor(String emailAddress)
          Get all the blog entries made by a particular author
 int getNoOfBlogEntries()
          Get the number of blog entries in the data store
 void removeAuthor(String emailAddress)
          Remove the author with the specified email address
 void removeBlogEntry(long id)
          Remove the specified BlogEntry, note that this must be a BlogEntry returned by this service.
 void updateAuthor(String email, Date dob, String name, String displayName, String bio)
          Update an author in the database
 void updateBlogEntry(long id, String email, String title, String blogText, List<String> tags, Date updatedDate)
          Update an post in the database
 

Method Detail

getAllBlogEntries

List<? extends Entry> getAllBlogEntries()
Get all the blog entries in the data store

Returns:
a list of BlogEntry objects

getNoOfBlogEntries

int getNoOfBlogEntries()
Get the number of blog entries in the data store

Returns:
the number of blog entries

getBlogEntries

List<? extends Entry> getBlogEntries(int firstPostIndex,
                                     int no)
Get the first N most recent posts starting from post X

Parameters:
firstPostIndex - - The index of the first post to be retrieved
no - - The number of posts to be retrieved starting from firstPostIndex

getBlogsForAuthor

List<? extends Entry> getBlogsForAuthor(String emailAddress)
Get all the blog entries made by a particular author

Parameters:
emailAddress - the author's email address
Returns:
a list of BlogEntry objects

findBlogEntryByTitle

Entry findBlogEntryByTitle(String title)
Get a BlogEntry that has a given title

Parameters:
title - the title of interest
Returns:
A BlogEntry with a specific title (or null if no entry exists in the data store)

getBlogEntriesModifiedBetween

List<? extends Entry> getBlogEntriesModifiedBetween(Date start,
                                                    Date end)
Get BlogEntries created or modified between two specified dates

Parameters:
start - The Date defining the start of the time period
end - The Date defining the end of the time period
Returns:
A list of BlogEntry objects

getBlogEntryById

Entry getBlogEntryById(long postId)
Obtain a given Blog post using its unique id.

Parameters:
postId - the posts unique id.
Returns:
the Blog post.

getAuthor

Author getAuthor(String emailAddress)
Get the details for an author

Parameters:
emailAddress - the Author's email address
Returns:
An Author object

getAllAuthors

List<? extends Author> getAllAuthors()
Get all authors in the database

Returns:
a List of Authors

createAuthor

void createAuthor(String email,
                  Date dob,
                  String name,
                  String displayName,
                  String bio)
Create an author in the database

Parameters:
emailAddress - The author's email address
dob - The author's date of birth
name - The author's name
displayName - ??
bio - The author's bio.

createBlogPost

void createBlogPost(String email,
                    String title,
                    String blogText,
                    List<String> tags)
Create an Blog post in the database

Parameters:
a - The author
title - The title of the post
blogText - The text of the post
tags - ??

updateAuthor

void updateAuthor(String email,
                  Date dob,
                  String name,
                  String displayName,
                  String bio)
Update an author in the database

Parameters:
-

updateBlogEntry

void updateBlogEntry(long id,
                     String email,
                     String title,
                     String blogText,
                     List<String> tags,
                     Date updatedDate)
Update an post in the database

Parameters:
email - The author's email
title - The title of the post
blogText - The text of the blog
tags - The list of tags
updatedDate - The date the update was made

removeAuthor

void removeAuthor(String emailAddress)
Remove the author with the specified email address

Parameters:
emailAddress - the email address of the author to remove

removeBlogEntry

void removeBlogEntry(long id)
Remove the specified BlogEntry, note that this must be a BlogEntry returned by this service.

Parameters:
id - the unique id of the blog entry to remove


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