Saturday, May 14, 2005

Question in ADF

I got this question: In a multi-page data entry flow where all the pages share the same underlying Entity Object, how should the entity level validation(validateEntity) be prevented until the user navigates to the final review and submit page. So, posted this question in a forum and got the response:
We have this SAME question.

We were thinking of:
1. add an attribute to the entity (not persistent) called pagenum

2. Expose this in the view

3. Expose in page as hidden value with the page# filled in

In validation methods (in EO) say:
public boolean validateEOfield1()
{
if thisFieldNeedsValidateOnPage( "field", getPageNum() )
{
// perform the validation logic here...
if ( thisFieldInError( "field" ) )
return false;
else
return true;
}

// if not on this page, then ...
// everything is ok
return true;

}

I haven't gotten very far with this idea and wanted to post a question, but I don't receive much feedback on my posts, so I wasn't sure what to do with it...

My Reply:
The above suggestion resolves the issue where the field validation is manually written by me in the EO. But, in case of declarative validations which I specify through Jdeveloper, how can I control the field validations.

One question here: model layer validations should be independent of the view layer right(either single/multi step). In this case, are n't we mixing the page flow logic
in our entity objects, which is a violation of MVC.

Instead, is it possible to get all the validation exceptions for all the EO's in the current transaction in the controller and check whether these exception can happen in the current page. If so, we will display these exceptions. Else, we will silently disregard these validation exceptions.

No comments: