Hi,
I have implemented a function to fetch articles of 'this user'.
It 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.
But I am not sure how we can do this by using File System Store since we are serializing the article objects to files. So we cannot extract 'this user' articles without fetching all the articles. We may have to store 'this user' articles in a special location when saving articles to store.