• 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

URLyBird findByCriteria

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
public long[] findByCriteria(String[] criteria);



Does the search has to be exact? For ex, my GUI allows the CSR to specify max. occupancy for the room. If the selected max. occupancy is 2, Can I return all the rooms with max occupancy of 2 OR higher? Or only rooms with
max occupancy of 2?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check your requirements in the instructions.html regarding the search.
What criteria has to be used?

Your findByCriteria API method says " any field value that begins with criteria[n]", but your GUI MAY (or may not) say EXACT criteria.

Write down what you took in consideration on your choices file that has to be delivered along with the code.

If your requirements file really include the occupancy field and does not say anything about an exact match, I guess it would be up to you to take a decision and justify it. If it is there and it says exact match, just parse the String criteria to an int and compare it with ==

Regards,

Kiev
 
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

As far as I know the UI must provide exact matches for the search criteria, that's the user needs, and it is a must option.
You can have a pluggable search criteria, but it must follow the specs - exact matches.

Regards M.
[ November 14, 2006: Message edited by: Mihai Radulescu ]
 
Mike Ngo
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

This is the requirement:

The user interface for this assignment must satisfy the following criteria:

It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.

This is the api spec:
// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
public long[] findByCriteria(String[] criteria);



so the only requirement is the hotel name and city must match exactly.
I am going to retrieve all the records matching the criteria for hotel name
and city and then filter out the results further for my application.
 
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic