• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Retrieval of record should be based on Key or Flight number ?.

 
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi reader,
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 ?.
Thank you,
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is as simple as this: use criteriaFind() to search records based on origin and destination (for the search requirement), and use find(toMatch) to pinpoint the record for which you want to book (for the booking requirement). The rest is transparent.
Eugene.
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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,
Michael Morris
 
Gurpreet Saini
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi morris and konovo,
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 ?.
Thank you,
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gurpreet,
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,
Michael Morris
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
Eugene.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ditto what Eugene said. I guess I just "pussy-footed" around and wouldn't come out and just say what needed to be said.
Michael Morris
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic