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 Booked Rooms 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 "Booked Rooms" Watch "Booked Rooms" New topic
Author

Booked Rooms

Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

I thinking about how do deal with booked rooms - wondering if you guys had any feedback\ideas?

The DB interface has no mention of the find-method not returning booked rooms. So should the find-method return booked rooms?

I am guessing that the GUI should not display booked rooms, right?

So if the find-method should return booked rooms and the GUI should not display booked rooms, then where do you guys filter out the booked room? In the business class?


SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5226
    
  12

My GUI displays booked rooms. When you select a booked room, the Book-button will be disabled.

There is no requirement to filter out booked rooms, so why would you do that anyway. And what if in a next version you have to add unbook-functionality?


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

Joined: Nov 04, 2009
Posts: 140

Ew, Roel said almost the same already (I left this reply window open for a while)

Sean Keane wrote:
The DB interface has no mention of the find-method not returning booked rooms. So should the find-method return booked rooms?

No, I think you should leave the data layer for what it is. You can search for records by calling the find method. This find method should not contain business logic, like filtering out undesired search results.

Sean Keane wrote:
I am guessing that the GUI should not display booked rooms, right? So if the find-method should return booked rooms and the GUI should not display booked rooms, then where do you guys filter out the booked room? In the business class?

The specs do not say anything about this. I just show them in my JTable. However, when a CSR clicks on a row that is already booked he can't book it anyway. I disabled the book button and I also have a validation in the business layer. If a CSR wants to book room x, I read room x and check if room.getOwner() != null.

SCJP, SCWCD, SCJD
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4373
    
    8

I also returned them all to the client. I did actually - and this really isn't necessary - add a table filter allowing the user to show only booked or unbooked rooms as well as an unfiltered list, but I felt if you were going to do that it should be in the UI instead of the business service (and definitely not in the DB interface, which I wanted to keep entirely ignorant of what it was being used for.
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Cheers guys! All sound opinions. Displaying booked rooms in the GUI is the way to go
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Booked Rooms