I have the following question on CriteiaFind method. Help approciated. 1. Does CriteriaFind be Generic or should we do only Carrier='SpeedyAir',Origin='SFO'" ? I think it should be generic. But the question is how much generic. Is the user allowed to enter in the criteria the field name in any order and in any order. Also user can give some of the filed names or all of the field names in the criteria. If so this method becomes very ugly to find out all the field names and corresponding values and put them in the order that is acceptable by method find ( or modified version of find method ). So please give me your advise here.
The user must be able to search for every field using an arbitrary combination. But it is not THAT difficult. My solution took about 50 lines. Have fun!
Marco Barenkamp<br />_ _ _ _ _ ________________________ _ _ _ _ _ <br />L M I N T E R N E T S E R V I C E S AG<br /> <br />Head of Software Development<br /> <br /> <br />BEA Certified Enterprise Developer<br />Sun Certified Programmer for the Java2 Platform<br />Sun Certified Web Component Developer for the Java2 Platform<br />Sun Certified Developer for the Java 2 Platform <br />Sun Certified Business Component Developer for the Java 2 Platform <br />Sun Certified Enterprise Architect for the Java 2 Platform Enterprise Edition<br /> <br />LMIS AG
posted 18 years ago
Hi Marco Barenkamp, Thanks for the reply. When you say arbitrary combination, does that mean any kind of query should be handled. I can write a method that can parse the string and arrange them in some order and I can create a method like find and get the results. This will work as long as you use on "filedName=Value" in the criteria string and do not repeat the same filed two time in the query. Also user can enter these fields in all or some and in any order. I can write a method that can handle this requirement. My Question is: Are we expected to handle AND, OR < > and etc operators in the criteria String. For Example: Origin='DEN' OR Origin='SFO' AND Price > '400' AND Price < 1200. Queries like this will be very difficult to parse and method requires a lot of intelligence. You�re Comment please
[This message has been edited by Raju, Gentle (edited September 17, 2001).]
I think handling AND, OR, <> in the criteria String will complicate the matter, and which is not required in the assignment. I think you should consider only "if the name/order/number of the fields is/are changed" then the method criteriaFind() should handle that without changing the implementation. According to me this is generic implementaion of criteriaFind(). Pratibha