Jump to: navigation, search

Newsreader/Salvo UI Integration in the workbench/Work done during June 9 to June 15

This week I worked on implementing a function to fetch articles from 'this user'.

I investigate the nntp protocol to check whether there exists something to query the server for all this users articles. There is no command for query it.

For fetching "this user articles" from store we can fetch all the articles from Store and filter out the articles using isMine method. But that is not good way to do that since we have to go through every article one by one.

So I planned of storing extra information when storing articles in the store, so that we can query easily. We have two options.

1) Storing the "this user articles" in a special location When we are fetching articles form the server and storing them in the store, we can check whether it is a "this user article". If so we can store it in a special location.

2) Store "userId" as a parameter of Article I thought this method thinking of using derby store. We can store the userId as a parameter of a Article. So we can easily fetch "this user articles" from a SQL statement.


When I investigate further I found that this can be implemented without storing extra information using derby store. I did the current implementation in that way. The implemented function is getThisUserArticles(INewsgroup newsgroup) located on ServerStoreFacade.

To implement this function, I have define a new method in IStore. getArticlesByUserId(INewsgroup newsgroup, String userId)

Currently, This function is implemented only in derby Store. In derby store, ArticleDAO is responsible for doing the operations related to Articles.

I have implemeted two methods in ArticleDAO. 1. getArticleIdsFromUser(String userId) - Get articleIds of a particular user 2. getArticleById(INewsgroup newsgroup, int id) - Get a article from the articleId

The first method extract the articleIds belongs to a particular user. To do that I have used the articleheader table. The second method can be used to extract the articles from the articleId.

Using these two methods getArticlesByUserId(INewsgroup newsgroup, String userId) method fetches articles belongs to a particular user.

So using the derby store we can fetch articles of 'this user' without going through all the articles stored in the Store.