GeeCON Prague 2014*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLyBird findByCriteria Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "URLyBird findByCriteria" Watch "URLyBird findByCriteria" New topic
Author

URLyBird findByCriteria

Mike Ngo
Ranch Hand

Joined: Oct 16, 2006
Posts: 89
// 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?
Kiev Gama
Greenhorn

Joined: Sep 11, 2005
Posts: 6
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
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

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 ]

SCJP, SCJD, SCWCD, OCPJBCD
Mike Ngo
Ranch Hand

Joined: Oct 16, 2006
Posts: 89
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.
 
GeeCON Prague 2014
 
subject: URLyBird findByCriteria