aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Book record at GUI level Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Book record at GUI level" Watch "Book record at GUI level" New topic
Author

Book record at GUI level

Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1512
    
    5

Hi,

Currently, at GUI level, I'm planning to do following:

1) User selects a record and hits 'book/reserve' button.
2) User enters new data (only 1 field can be changed).
3) User hits OK.

Now, what happens if another user actually books the record in between? Since I've implemented a thin client, actual 'lock-update-unlock' will happen after user hits OK button. But if record is already booked by other user after this user enters data (and before user hits OK button), what should I do?

I'm planning to throw RNFE with different message (say record is already reserved etc.) and depending on the message from RNFE, I'll show respective message box at GUI level. I'll also have a 'refresh' button at GUI. Is it fine?


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Anayonkar Shivalkar wrote:But if record is already booked by other user after this user enters data (and before user hits OK button), what should I do?


Tell the user that the record is no longer available. Then refresh the table contents so that they can see that the room is booked.


SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5608
    
  15

Sean Keane wrote:Tell the user that the record is no longer available. Then refresh the table contents so that they can see that the room is booked.

Exactly what I did.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Dmitry Kotlov
Greenhorn

Joined: Sep 09, 2011
Posts: 23

Hi Roel!
Just a small question about subject. I've opted to thin client.
What do you think where is the most appropriate place to check the availability of a record at business layer or at gui layer? I'm inclined to think that the business layer is better. What can you say?

Thanks,
Dmitry


OCMJEA, OCJP, OCJD, OCE SQL, OCP Forms Developer, OCP PL/SQL Developer
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2268
    
    3

Dmitry Kotlov wrote:What do you think where is the most appropriate place to check the availability of a record at business layer or at gui layer?


Well, if you put it in the presentation layer, then you would lose portability. If you opt to use your business model in another scenario (a web app, for instance), then you would have to write your code again in your controllers (servlets, ClickHandlers (GWT), ActionListeners (Echo3), @Controllers (JSF) and so on). Other then that, the presentation layer isn't appropriate to execute any business rules.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Dmitry Kotlov
Greenhorn

Joined: Sep 09, 2011
Posts: 23

Roberto Perillo wrote:
Dmitry Kotlov wrote:What do you think where is the most appropriate place to check the availability of a record at business layer or at gui layer?


Well, if you put it in the presentation layer, then you would lose portability. If you opt to use your business model in another scenario (a web app, for instance), then you would have to write your code again in your controllers (servlets, ClickHandlers (GWT), ActionListeners (Echo3), @Controllers (JSF) and so on). Other then that, the presentation layer isn't appropriate to execute any business rules.


Thanks,
Roberto!
You've approved my guesses!!

Good luck and have a nice day!
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5608
    
  15

Dmitry Kotlov wrote:What do you think where is the most appropriate place to check the availability of a record at business layer or at gui layer? I'm inclined to think that the business layer is better. What can you say?

Checking for room (contractor) availability is clearly a business requirement, so that's something you put in the business layer. With a thin client your GUI will be very stupid and contains very little to none business logic.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Book record at GUI level