Pupun Moh

Greenhorn
+ Follow
since Apr 14, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pupun Moh

As an example to my problem...

Employee Bean:
**************



Class which will have the generic method to compare the DTO object and “ArrayList of DTO objects” for best possible match
***********************************************************************************************




Main class to calling the similarObjects methods:
****************************************



I am not getting any idea as how to go ahead . Please provide me with some algorithm or ideas to work it out.

Regards,
Pupun.

14 years ago

Paul Clapham wrote:If you have "degrees" of similarity -- i.e. one object can be "more similar" to an object than a second object is -- then an "equals" method isn't going to be of any use. You want a "similarity" method which returns a number between 0 and 1, or between 1 and 100, or between negative infinity and positive infinity, whatever the possibilities are.

Then you need a method which scans the list and picks the member X for which similarity(X, Base) is maximized.



Hi Paul,
Thanks for providing a reply and giving more depth to the topic.
If you could please throw some more light and provide a possible solution algorithm. I am trying out possible solutions but always getting stuck at one place or other. It would be nice if you could exemplify your point with respect to my problem.

Hi Henry,
Now as Paul as provided a new dimension to the problem. Please provide your suggestions too.

Regards,
Pupun
14 years ago
Hi,
Seems things are getting clear.
I will try to implement the solution by overriding equals method. Please correct me if I am wrong. The possible algorithm would be.
1. Pass dynBeanObject and Arraylist to the method.
2. Override equals method to compare every field of the dynBeanObject to the beans from arraylist.
3. Add the mathcing object to the new arrayList and return it.

I have one doubt here, on keeping track of the matching fields. Suppose A matches so I have to keep a track that in the following bean A has matched. Then if B matches, I have to update the the tracking variable.

Something like to keep a record that previous fields have matched and one more filed is left to be matched before adding the object to new arrayList.

Regards,
Pupun
14 years ago
Hi Henry,
Thanks for you reply.
Try 1: I tried by individually comparing the values by looping through the entire list, which I realised is not a good solution and also I got stuck in lot of loops with several permutation/combination of possible dynBeanObject.

Try 2:I have an idea of using Comparator, but it will require to write comparator for every field.
But as the bean object is dynamic, so writing a comparator for every filed is not a good solution. There can be several beans...and each bean will have several fields.

Moreover I would like to create a generic solution which can be re-used. Also at runtime, I will neither have idea about the the bean class associated with dynamic bean object and the ArrayList of objects.

Please provide me with some steps to go ahead.

Regards,
Pupun.
14 years ago
I have a requirement in which a dynamically created bean object has to compared on a ArrayList of similar bean objects to find the best possible match.

Suppose the object which is dynamically created bean object is having values as dynBeanObject{null,null,A,B,C}, where the first two fields have been intentionally set to null.
Now on comparing with the ArrayList of similar objects, results should be an ArrayList of all the objects which have {---,---,A,B,C} as the pattern. Means all the objects which have A,B,C will be added to the new list.

Please guide me to create a filtered array list to which I supply the dynBeanObject and the ArrayList. The return of the method will be an ArrayList of filtered objects.

Regards,
Pupun.
14 years ago
I have a requirement in which a dynamically created bean object has to compared on a ArrayList of similar bean objects to find the best possible match.

Suppose the object which is dynamically created bean object is having values as dynBeanObject{null,null,A,B,C}, where the first two fields have been intentionally set to null.
Now on comparing with the ArrayList of similar objects, results should be an ArrayList of all the objects which have {---,---,A,B,C} as the pattern. Means all the objects which have A,B,C will be added to the new list.

Please guide me to create a filtered array list to which I supply the dynBeanObject and the ArrayList. The return of the method will be an ArrayList of filtered objects.

Regards,
Pupun.
14 years ago
I have a requirement in which a dynamically created bean object has to compared on a ArrayList of similar bean objects to find the best possible match.

Suppose the object which is dynamically created bean object is having values as dynBeanObject{null,null,A,B,C}, where the first two fields have been intentionally set to null.
Now on comparing with the ArrayList of similar objects, results should be an ArrayList of all the objects which have {---,---,A,B,C} as the pattern. Means all the objects which have A,B,C will be added to the new list.

Please guide me to create a filtered array list to which I supply the dynBeanObject and the ArrayList. The return of the method will be an ArrayList of filtered objects.

Regards,
Pupun.
14 years ago
Hi Folks,

I have a requirement in which I have to create a JSF Datatable which will fetch data from a HashMap<String, ArrayList> where the Key corresponds to the column name and the value will be an ArrayList of data for the column.

As of now I have two columns EmpName and EmpNo.

Here is the POJO/Bean Class:

Here is the backing bean:



Now how do I go ahead and construct the dataTable so that it picks up the Key as column name and Arralist as the data in the column.

Please provide your suggestions and code snapshots.

Help is appreciated.

Regards,
Pupun
14 years ago
JSF
Yeah I understand the difficulties but anyway one or the other day I had to face it. So I have to ramp up on the tag thing. Will try to get hold of the book and do some practice this weekend.
It would be really helpful if you can give some links or pointers where I can get some examples/codes on it.
14 years ago
JSF
Hi Tim,
Now it has given me some clear picture about the Datamodel.....but alas I have to go for a custom component for Datatable which should have the componets as in the picture.
Can you please guide me on it?
14 years ago
JSF
Hi Tim,
Thanks for the reply. I appreciate it.
For the UI part, will developing a custom component be of any help? The custom component will have a datatable, input text box, drop down menu and a command button as show in the attached picture.
Please provide me links/pointer where I can similar custom component.

Now the search has to be done on the datatable which is currently in the memory, rather than fetching the result from database. Moreover the search criteria contains column name and row data. How can I perform the search in this scenario?
Will ResultSet which has been used to retrieved the table be of any use?

Rgrds,
Pupun
14 years ago
JSF
Hi Amit,
Thanks for providing me information about the naming policy. I have changed my name accordingly.
14 years ago
JSF
Can someone please look into my doubt?.
I would appreciate it.

I really need some pointers to go ahead.
14 years ago
JSF
Hi,
I have a requirement of implementing Search and Filter over a datatable.
The datatable I am using has 5 columns Name, Surname, State, Dept, Location.

The requirement goes as, there would be a input text box for writing the searchable record and a drop-down menu beside it which will automatically take the column names as its values. This drop-down will act a filter.

One would type a record and select the column from the drop down where it has to be searched and click Search button. If found then the record is displayed in the datatable and if not then "No records found" will be displayed.
Again the Search will not retrieve records from the database, but only the records which are presesnt in the memory based on which the datatable is formed.

Ihave attached a picture of the requirement.
Please help me and provide me suggestions/code samples as how to proceed.

Regards,
Awe


14 years ago
JSF