aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S Booking a Record Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S Booking a Record" Watch "B&S Booking a Record" New topic
Author

B&S Booking a Record

Murali Kurukunda
Ranch Hand

Joined: Oct 20, 2003
Posts: 36
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
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

The extra validation will not hurt you. As in Owner, I am expecting you mean it is already booked by someone else.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Murali Kurukunda
Ranch Hand

Joined: Oct 20, 2003
Posts: 36
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
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

    Joined: Mar 28, 2003
    Posts: 11432
        
      85

    Hi Murali,

    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.

    Regards, Andrew


    The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
    Mark Spritzler
    ranger
    Sheriff

    Joined: Feb 05, 2001
    Posts: 17250
        
        6

    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://aspose.com/file-tools
     
    subject: B&S Booking a Record