This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S Booking a Record

 
Murali Kurukunda
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The extra validation will not hurt you. As in Owner, I am expecting you mean it is already booked by someone else.

Mark
 
Murali Kurukunda
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
    Pie
    Posts: 11833
    181
    C++ Firefox Browser IntelliJ IDE Java Mac Oracle
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
     
    Mark Spritzler
    ranger
    Sheriff
    Posts: 17276
    6
    IntelliJ IDE Mac Spring
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic