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 An issue about record booking 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 "An issue about record booking" Watch "An issue about record booking" New topic
Author

An issue about record booking

Mike Tilling
Ranch Hand

Joined: Feb 17, 2006
Posts: 86
It is indicated in the assignment (UrlyBird) :
"They take bookings only within 48 hours of the start of room occupancy"

It also describes the field owner as follows:
"If this field is all blanks, the record is available for sale"

It describes the date field as follows:
"Date available : The single night to which this record relates, format is yyyy/mm/dd."

In my implementation:
1- On a create operation, I choose to provide all values except the customer,
I suppose the newly created record is for future booking purpose.

2- The record is ready for booking if date is today (the record is available for today) tomorrow or after tomorrow regardless of what does the owner field contain.

I am worried about this spec about the field owner "If this field (owner)
is all blanks, the record is available for sale". The booking system is
Based on the record availability and not on the content of the owner field.

When booking the record, a dialog box is prompted asking for the customer ID, the booking date and the duration which is the number of nights the room is booked for, if the booking date is prior to the today date or the record available date the user will be notified by an error message otherwise the booking request will be accepted and the date field will be the booking date increased by the duration (the number of nights the room is booked for).

Do I fit with the exam spec?

What do you provide as parameters when booking the selected record?

*I am thinking about changing the way I am booking the record as follows:

- On a create operation, I will provide all values including the customer.
- The booking request will be accepted if (date is today and owner is empty)
Or (date is tomorrow and owner is empty) or (date is after tomorrow and owner is empty)

Will that fit better?

If date is after today +48 hours and the owner is empty, will the room be ready for booking?
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
I can tell you what I am doing, and in a few days I can tell you if it works. I have to upload my assigment in about 19 days.

Now, in URLyBird assignment it is not required that the GUI (Graphical User Interface) offers all the functionality of the DBAccess.java interface.

Actually, it only requires to display data and to book a room within 48 hours of availability.

Nevertheless, it is required that all the DBAccess.java interface is implemented. So I did it.

My create method considers all the fields mandatory, if one field is missing I throw an IllegalArgumentException. So, when I create a new record, it can be a record of an unbooked room or a booked one, because I have to provied the value of the owner field.

Now, from my point of view, availability implies that the room is within 48 hours of availability and that the room is not already booked. Therefore, if a room is booked I do not consider it available, even if it is within the so-called 48-hours of availability.

But you could implement the unbook operation (again, not specified in the instrucions.html file of mine), and then reassign the room to other guest or client.

Does this makes sense to you?
Mike Tilling
Ranch Hand

Joined: Feb 17, 2006
Posts: 86
Thanks Edwin

I understand that the room can be booked if the owner is not empty regardless of what the date (available date) is. If the date is 10/10/2005 (one year ago) and the owner is not empty then the room can not be booked, what the user should do is to unbook the room to reset the owner into blanks or reaffect it to an other customer, the unbook reset the owner regardless of the date value.

Thanks a milion
Mike Tilling
Ranch Hand

Joined: Feb 17, 2006
Posts: 86
Edwin,

other question please

If date is after today +48 hours and the owner is empty, will the room be ready for booking?

Regards
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961

I understand that the room can be booked if the owner is not empty regardless of what the date (available date) is.


I want to set clear that this is what my createRecord(String[] data) method does. And it is this way because I do not like to enforce business rules in this level of my implementation.

My Data class is unaware of business rules or data types. Therefore, all that I do at this level is to enforce the number of columns; and all I do is to check that the provide data array passed to the createRecord() actually contains as many fields as columns are defined in the database metadata. My implementation of createRecord() also checks if any of values of the array is a null item and replaces it for an empty String.



Wrapping up, if somebody used the plain method createRecord(), this person could create a record that is booked without the 48 hours of availability. However, in my implementation of the URLyBird assignment, the client applications do not use the Data class directly.

I have wrapped the data class into a more intelligent business-aware and data-type aware class which is, ultimately, the class that will be exposed in the RMI registry.


The unbook reset the owner regardless of the date value.


Now, I have not implemented unbook, but if I had done it, I would only let to unbook records within the same 48-hours of availability that are valid to book them. Namely, if a record is not valid to be booked, I would not make it valid to unbook.


If date is after today +48 hours and the owner is empty, will the room be ready for booking?


I would say it is not. I am yet working on that, but I believe that, probably, I will use different colors to distinguish the different type of records, old records, available records, and records that will be available in the near future.
[ October 10, 2006: Message edited by: Edwin Dalorzo ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: An issue about record booking