File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLyBird Data find(String[]) method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "URLyBird Data find(String[]) method" Watch "URLyBird Data find(String[]) method" New topic
Author

URLyBird Data find(String[]) method

Cathal Mullan
Ranch Hand

Joined: May 20, 2011
Posts: 118
Hey Guys,

for my URLyBird project when I provide search details for the Hotel Name & Location I am to provide EXACT results from the DB. However in the Comments on the DB interface it says the find(String[]) method will return results where the DB fields BEGIN with the search criteria.

To get around this discrepancy I am planning to create an interface that extends the DB interface with a findExact(String[]) method. I will implement the find(String[]) method also but not actually use it.

Just wondering if anybody who has already passed the exam did this instead of using the predefined find(String[]) method?

cheers
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5593
    
  14

I also created an extra interface (extending the given one), but I didn't add a findExact-method. I just filtered the results from the find-method in my business layer. I added an extra find-method which returns a map with record numbers and String[] pairs. So I didn't use the predefined find-method and passed


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Cathal Mullan
Ranch Hand

Joined: May 20, 2011
Posts: 118
Cheers Roel, I had contemplated doing that also, it makes more sense to get back the exact results needed like you would using a proper database. But I suppose I should use the method they have defined & log my reason in my choices.txt,

cheers for your advice
Jim Hoglund
Ranch Hand

Joined: Jan 09, 2008
Posts: 525
Cathal: There is no discrepancy in the specification. It is asking for
a typical "wild-card" search capability. This is consistent with saying
that a blank criteria field should match all values of that field. In the
extreme, a find() where all the criteria strings are blank should return
all the data rows. In a real example from the URLyBird hotel data,
the single search character "p" for the hotel name field, should return
7 rows; the three Palace hotels plus four Pandemonium hotels.

Jim ...


BEE MBA PMP SCJP-6
Cathal Mullan
Ranch Hand

Joined: May 20, 2011
Posts: 118
Cheers for the reply Jim. What your saying makes sense. Don't think I'm going to risk it though. There is a must requirement that says ".. records where the name and/or location fields exactly match the values specified by the user" but the doc above the find() method says ".. A non-null value in criteria[n] matches any field value that begins with criteria[n]... ". So a subtle difference there. Just don't want to risk getting an automatic failure,

Cheers for your input though
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5593
    
  14

I implemented my find-method just as Jim says: passing "p" for the hotel name field will result in 7 records returned by the find-method. Entering the "p" in the hotel name search field in the gui will result in an empty table, because there is no hotel at all that has "p" as name.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URLyBird Data find(String[]) method