New Posts New Posts RSS Feed: Custom validation example
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Custom validation example

 Post Reply Post Reply
siko View Drop Down

Joined: 26-Mar-2012
Posts: 27
Post Options Post Options   Quote siko Quote  Post ReplyReply Direct Link To This Post Topic: Custom validation example
    Posted: 12-Sep-2012 at 5:58am

I'm a bit confused on how to implement the following 'business rule':

An assessment cannot be saved if there is already an assessment for a certain date, applicant and assessment-type. (assessment, applicant, assessment date are 'unique'). We might in the future have to add 'for a certain user domain/organization' ... so we don't think of solving this with an unique index on db level.

Validation rule. With other words, find async the assessment with the same date, applicant and assessment-type as the assessment to be saved and returns 'all good' if none found.

With what:
Here it becomes a bit blurry. It seems the Verifier route is the way to go. But I get stuck Finding the assessments async.
And I don't really get if the EntityServerSaveInterceptor is the place to do this check.

Any help would be appreciated!
Back to Top
mgood View Drop Down

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 12-Sep-2012 at 7:55am
The way to go here is a validation service that can be called asynchronously by the ViewModel before allowing the user to save.
This scenario is discussed here:
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down