Hi, When updating the record for Inside book() method, should the owner field be checked to see it is empty or it is assumed that the users will not try to book a record that already has a owner? Murali
yes. By owner field I mean that someone already booked this record. And the customer Id shows up in the owner field when users search for records.
I am thinking that check is optional, since the CSR's know about customer ID field and they will not try to book that contractor. If I want to put that extra validation where should it be? Inside updateRecord() method? any ideas? Murali
Matt Sheehan.
Ranch Hand
Joined: Oct 08, 2004
Posts: 63
posted
0
There is also the posibility that the record has been booked by another client since the table was last refreshed. This is the reason for the DB interface's lock/unlock methods. You can address the issue in your book method like this:
lock record
verify record has not changed since you last accessed it
verify record is not booked
update record - adding cust ID
unlock record
[ December 08, 2004: Message edited by: Matt Sheehan. ]
Andrew Monkhouse
author and jackaroo
Marshal Commander
We don't have many rules here, but one we do have is the JavaRanch Official policy on registered names. We need you to display both a first and a last name. Could you please change your displayed name to meet this policy? You can change your displayed name here.
Check your instructions with respect to how the "customer" field is described in the Data File Format section. If it says something like "If this field is all blanks, the record is available for sale" then you will need to validate that the field is blank before you book it.
Originally posted by Murali: yes. By owner field I mean that someone already booked this record. And the customer Id shows up in the owner field when users search for records.
I am thinking that check is optional, since the CSR's know about customer ID field and they will not try to book that contractor. If I want to put that extra validation where should it be? Inside updateRecord() method? any ideas? Murali
Well, I would put the validation in the business service, not directly as part of the database code, because this is application logic, not database logic. So somewhere in your Facade that does all the logic. Personally I would create a isBooked(Record a) method, probably private.
Mark
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.