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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "booking revisit" Watch "booking revisit" New topic
Author

booking revisit

Andy Zhu
Ranch Hand

Joined: May 26, 2004
Posts: 145
I have B&S and my instruction on data format for owner item says: it's an 8 digit id and I should record as it is. If it's blank, it is for sale; otherwise, it is booked. On the gui part of client, it requires a book functionality.

I am trying to clarify the business logic of updateRecord and client book function. My understanding is

1. for booking, only allow user to input an owner id
2. validation of user input for max 8 bytes integer number (required),
3. updating only for owner field and flag in the database.

However, do I need to allow updating a blank input for unbooking a record? This will provide me for allowing user rebooking a record, which makes more sense to me? Or I misinterpret instruction and should not allow blank input.

old new meaning
------------------------------
blank blank ok; no change
avalue avalue ok; no change
avalue blank ok; unbook
avalue bvalue error; flaged
blank avalue ok; book

This is the scheme I have now. I am near the end of project. Please help me.


--------<br />Andy Zhu<br />scjp 1.4<br />scjd 1.4<br />SAS Certified Programmer 9.0
Anton Golovin
Ranch Hand

Joined: Jul 02, 2004
Posts: 476
Hi, Andy! For booking, only allow 8-digit integer number; watch for numbers starting with 0 or 0s. For unbooking, your update method in your Data class should not require that field to be anything, only check it holds valid numerical data and is of the correct length. Your book and unbook methods would actually check for valid input for booking and unbooking.

In terms of the project, only booking functionality is needed.
[ November 22, 2004: Message edited by: Anton Golovin ]

Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
Andy Zhu
Ranch Hand

Joined: May 26, 2004
Posts: 145
Hey, Anton, first congratuation to you. I wish that day would n't that far for me.

Thanks. You posted a new question to me. that is leading zero. So far, I treat owner, as well as other field, as string. so leading zero is significant.

So, you mean, in client side, I should take booking literally if following instruction strictly. Unbooking is not part of booking. Therefore, I shouldn't allow a blank input for booking a non-blank owner (ie unbooking). Yes, you are right that sun doesn't require unbook in gui, but it requires to record a owner id as it is, which confused me of when the input is blank.
Anton Golovin
Ranch Hand

Joined: Jul 02, 2004
Posts: 476
Hi, Andy! Thanks! To answer your question, you would write the book method to accept only valid booking values; and if you decided to write the unbook method, you would write it to accept only blanks. On the server-side, your Data class would run update, which should only check that the entry is not longer that 8 bytes. This way, you separate the business-rule checking from the data checking.
Andy Zhu
Ranch Hand

Joined: May 26, 2004
Posts: 145
thanks. Exactly to separate business rull from data. What I thought, conceptually blank is a value if we view unbooking is a special case of booking. But sun seems not happy about it:-)
Andy Zhu
Ranch Hand

Joined: May 26, 2004
Posts: 145
Hey, Anton: one more about updateRecord in data layer: if an existing record's flag is "booked", and the new input owner is not blank, I guess I should not honor this request even in database layer. What do you think? Do I misunderstand instruction?
Anton Golovin
Ranch Hand

Joined: Jul 02, 2004
Posts: 476
Originally posted by Andy Zhu:
Hey, Anton: one more about updateRecord in data layer: if an existing record's flag is "booked", and the new input owner is not blank, I guess I should not honor this request even in database layer. What do you think? Do I misunderstand instruction?


Hi, Andy. I think it should be honored in the data layer but not in the business layer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: booking revisit