• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

booking revisit

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 531
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Andy Zhu
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 531
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 531
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic