1- which parameters do you provide when booking the room?
Your approach is interesting, because your are providing the
duration. So, you reset the availability date to the end of the reservation period.
In my case I am just setting the ownership of the record and keeping the date as is. I believe that changing the date of record would tell when the reservation period ends, but not when it started, and I my case I believe that the important thing is to know when the client is going to get to the hotel.
Now, it is not stated in the specification, but I guess there should a process, in the future, that allows a client to cancel a reservation or to check out from the hotel, in whose case, the availability date would be reset to a new value.
My booking method signature is:
DAOHotel.book(Hotel hotel,String owner). And it simply assigns the value of the owner to the hotel hotel record and updates the corresponing object.
However, as you know,I would not dare to say that your approach is incorrect.
2- I am getting confused about the role of the owner and date fields, In my implementation the booking request is 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). am I wrong?
I am doing the same thing, I determine availability of a room based on the current time plus 48 hours. I do the calculation using a Calendar:
So, basically it is the same thing that your are doing, that might work for today, tomorrow and the day after tomorrow. But I've been feeling like you, that is: is this what 48-hours really mean?
3- If available date is yesterday and owner is not empty, do we allow the room to be booked? (it is available but owner is not empty!)
As I said before, I consider this rooms not available. I assume that another process (unknown to me) of guest checkout or reservation cancelation is responsible of reseting the values of these rooms, or maybe the guest simply decided to stay longer in the hotel. Therefore I consider this rooms not available.
5- If date is after today +48 hours and the owner is empty, do we allow the room to be booked. (it is beyond the scope of 48 hours but not affected to any one!)
I consider these cases as
"not available". And this particular case I would not risk to do otherwise.
[ October 11, 2006: Message edited by: Edwin Dalorzo ]