Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] [Salvo] Function to fetch articles that "this user" has created or that "this user" has replied to

Hi Harshana,

To Implement the function getThisUserArticles(), initially I planned to store extra information for a article or store 'this user' articles in a special location in the store.

I saw that this can be implemented without storing extra information, but executing several queries on existing database.
So I have implemented it in that way.
Is it the right way to go? WDYT?

On Mon, Jun 13, 2011 at 11:38 PM, Isuru Udana <isudana@xxxxxxxxx> wrote:


On Mon, Jun 13, 2011 at 11:29 PM, Harshana Eranga Martin <harshana05@xxxxxxxxx> wrote:
Hi Isuru,

On 13 June 2011 23:04, Isuru Udana <isudana@xxxxxxxxx> wrote:
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.

I think we can  solve it by appending a special tag (for e.g: userId) to file name of the file that are representing the articles. Then we take out the whole file list and and then it's just gonna be a string manipulation to search the articles from there. WDYT?

Yes. That can be done.
 
Thanks and Regards,
Harshana



On Sun, Jun 12, 2011 at 1:11 AM, Isuru Udana <isudana@xxxxxxxxx> wrote:
Hi Wim, Harshana,

I am working on implementing the $subject.

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 am planing 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.
I am not sure how we can do this with File System Store. I think File System Store is not suitable for this kind of advanced data retrievals.

Please express your view on this.
--
Regards,
Isuru Udana

Undergraduate
Department of Computer Science & Engineering,
University of Moratuwa
.

Blog
: http://mytecheye.blogspot.com/
gTalk: isudana  skype: isudana








--
Regards,
Isuru Udana

Undergraduate
Department of Computer Science & Engineering,
University of Moratuwa
.

Blog
: http://mytecheye.blogspot.com/
gTalk: isudana  skype: isudana








--
Thanks and Regards,
Harshana Martin
--
Harshana Eranga Martin
Software Engineer,
WSO2 Inc.
           http://wso2.org





--
Regards,
Isuru Udana

Undergraduate
Department of Computer Science & Engineering,
University of Moratuwa
.

Blog
: http://mytecheye.blogspot.com/
gTalk: isudana  skype: isudana








--
Regards,
Isuru Udana

Undergraduate
Department of Computer Science & Engineering,
University of Moratuwa
.

Blog
: http://mytecheye.blogspot.com/
gTalk: isudana  skype: isudana






Back to the top