Now, what is to prevent clientB from using lockCookie1 to work with or unlock record7?
BTW, locking the entire database is not necessary. You should only account for locking the record in question.
Originally posted by Jared Chapman:
Hey Alan,
The first think you should do in the read method is to check the flag. So to do this, you should navigate to (offset * recNo) in your data file. Then, you read the flag. If the record is marked as valid, then return the fields (i.e. name, location...etc) in a String[]. If the record is marked as invalid, then throw a RecordNotFoundException. At this point, the file pointer will be at the beginning of the first field (name). If the record is valid, read the fields of the record, populate your string array, and return it.
As far as deleting a record goes, you simply want to navigate to (offset * recNo), which will put you at the flag, and write OxFF. So according to my specs, you don't use read or update at all to delete a record, but rather use a delete(recNo) method.
Hope this helped.
Originally posted by Jared Chapman:
I wouldn't return this with the String[]. If the flag specifies that the record is deleted/invalid, then just throw a RecordNotFoundException.
Originally posted by Ta Ri Ki Sun:
I have a Record class, which has Columns, and a Room which is a Record. I refer to that column as Room.OWNER when working with the String[], else it's room.setOwner(owner)
Originally posted by Ta Ri Ki Sun:
Hi Alan
Create and delete, I've yet to see someone post that they've passed without implementing those methods, they may have, and never posted, or I didn't see it. The interface has to be implemented, and there's a good chance those methods form part of their tests.
Unbook/cancel booking is unheard of, but I made it easier to later implement this by not filtering records displayed to the user based on whether they're booked or not. All records, except deleted ones, are displayed, even if they're in the past. As I said last week I feel this allows a user to do more than make a booking, they can track bookings, confirm a clients booking, print a report when filtering a specific hotel or location, and possibly in the future cancel a booking.
Whatever you do make sure you can justify your decision, and you should be alright