I am in confusion regarding the retrieval of records. I had implemented a record search facility based on record Number. The user simply enters the number of record in between 1 and 24 and record is retrieved. But when I studied Robert and Heller. It states the retrieval of record should be based on KEY. If this is the case then shall I use criteriaFind() method or give a call to find(toMatch) method for retrieval of record based on KEY ?.
Secondly, for the retrieval of records I had one search class facility which retrieves only carrier matching records by using criteriaFind() method. On the other hand I also have Carrier,Origin,Destination Multiple Search record retrieval facility. Which already has the function of retrieving all the carrier matched records. That is done when user selects "All origins" and "All destinations" it retrieves all the carrier matching records. Now, you can see I have two things for same functionality. Please do suggest me shall I abort the first one which is exclusivly retrieving records based only on carrier selection or shall retain it ?.
and use find(toMatch) to pinpoint the record for which you want to book (for the booking requirement).
Actually there is never a need to make a direct call to find(toMatch) for booking since modify makes the call for you. You can just call getRecord (since we know the record number is unique) for your read which is considerably faster than find.
Hope this helps,
What you both suggest I am only implementing that. Tell me shall I implement another record search facility on KEY ie (SA001 ..etc), which will make call on find(toMatch) method through interface as morris suggested once in my earlier post. Secondly, I said that I had already two search facilities for retrieving carrier matched objects, same functionalities but two different search facilities. Shall I abort the first one ?. Because I think there is no need for first one. What you have to say ?.
Not knowing exactly what you have in mind, it's hard to say. All I did was create the criteriaFind method as it was a requirement. It was publically available in my DataAccess interface. For the criteriaFind implementation, I just looped through all the records (using gerRecord) and if a particular record did not match the criteria I did not include it in the DataInfo. Now for booking as I said before, I just re-read the record with getRecord before comitting the booking, but the find method would work just as well albeit somewhat slower.
If your design in some way requires you to implement something other than find or getRecord, then do it. Just be certain that it is a necessity.
Hope this helps,
Secondly, I said that I had already two search facilities for retrieving carrier matched objects, same functionalities but two different search facilities. Shall I abort the first one ?.
Here is your plan:
1. Implement criteriaFind(String criteria) such that it can accept a generic criteria (any number of field-value pairs).
2. Use the implemented criteriaFind(String criteria) method to search flights, by passing origin and destination (and possibly carrier) as a criteria.
3. Use either find() or getRecord() (or combination) to book a flight.
That's all there is to it.