File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Decision based on priority Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Decision based on priority" Watch "Decision based on priority" New topic

Decision based on priority

Soheil Tayari

Joined: Apr 04, 2008
Posts: 29
Hi, I'm facing a design issue which I would like to get some suggestions on. I'm developing a web app in which I would like to show different types of content say News, Articles and ... I want to let the user to prioritize the contents being shown to her. The type of contents shown to each user varies and there's a maximum entries to be shown on the page which can be modified by user. Now how can I specify how many entries of each content be shown to user based on it's priority. Any help would be appreciated.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 45255
Do you mean the objects in your results have some sort of values attached, and you wish to sort on those values?
Soheil Tayari

Joined: Apr 04, 2008
Posts: 29
Not just sort, but control the number of each object type based on their values in a way that "objects created <= total objects allowed".
Maybe an example could clarify a little: I want to show some news and articles on the web page. User has defined that she's more interested in news than articles and she don't want to see more than 10 entries every time page loads. Now there might be more than 100 entries for each News and Articles but I have to show only 10 in a way that user's preference is preserved and there's more news than articles. Now how can I do it when the types of content can grow in the future and the cap on the total entries varies too. Thanks for any kind suggestion.
Henry Wong

Joined: Sep 28, 2004
Posts: 20359

Well, you have to track the user preferences too. You will needs some way for your users to set (and persist) her preferences. And your display code needs to fetch (and use) those preferences, in addition to fetching the news. No black magic here -- just more coding.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
wood burning stoves
subject: Decision based on priority
It's not a secret anymore!