These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]

Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: The Calendar Application Problem: Preserving DRY
PostPosted: Mon May 05, 2008 2:28 pm 

Joined: Fri Jul 29, 2005 9:46 am
Posts: 101
Imagine you have to build a web version of SunBird, its core is pretty simple, it helps you plan what are you going to do on a particular date at a particular hour (in a particular place).

So, you build the first stable version of your application and you and it over to you testers, and they try to do this:

  • Meeting 2008/May/10 at the Bank of America from 10 AM to 11 AM
  • Meeting 2008/May/10 at the Safeguard Insurance from 10:30 AM to 11:30 AM

Ups.... you have a problem you can not be in both places at the same time... and before you can think of the answer to that, your boss arrives and tells you: "we have a new requirement from marketing" if this is a web version, it should have collaboration capabilities, and therefore it should be possible to easily find a moment when everybody is available for a meeting.

So, now, you have 2 problems: the system most tell you if you have a conflict in the schedule of a particular user, and it must also tell you, if you need a meeting between many users,if a particular time and date is free from conflicts.

This can be easily solved with a couple of SQL queries, but you are coding with Hibernate, and you want to use Hibernate Validation..., all you have to do, is send a message like this when a conflict is found (I use {} from contextual information):

"I am sorry but your meeting at {Safeguard Insurance} on {2008/May/10} at {10:30 AM to 11:30 AM} has a conflict with a previously set meeting on {the same date}, from {10 AM to 11 AM} with {Bank of America}"

But suddenly you realize you cannot (should not? what is the "recommended best practice" here?) call the EntityManager in you Validators... and in that particular moment you boss arrives again and tells you: Please, do not forget that our Calendar Application will also offer a WebServices front end, and the ability to import from Excel worksheets (and it will, of course prevent any scheduling conflicts). And of course, being a good developer you know you can not deal with this doing only some client-UI calendar component tricks (after all, the client can never be trusted)

Will JSR 303 help make this kind of validation easier? (Specially without violating DRY ?)

 Post subject:
PostPosted: Thu Jun 05, 2008 5:51 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I am not sure solving this problem really belong to a Constraint declaration.


Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.