You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2017/04/20 04:31:04 UTC

[jira] [Commented] (MYFACES-4109) Implement f:validateWholeBean

    [ https://issues.apache.org/jira/browse/MYFACES-4109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15976055#comment-15976055 ] 

Leonardo Uribe commented on MYFACES-4109:
-----------------------------------------

I have been trying to fix this one, but it has been proved challenging.

The big problem is there is a part that says this:

"... Class-level bean validation must operate on a sufficiently populated bean instance. This differs from JSF field-level validation, which prevents beans from being populated with invalid values. To accomodate this difference, the candidate bean must be copied, populated with the already-validated candidate values, and then subjected to class-level validation ..."

The copy is not a problem. The problem is how to populate the candidate values. After reading the spec it was mentioned that f:validateBean should keep track of the "candidate values", which I guess it is better to store them in the view transient map. But the "bean population" or "update model" step is done in update model phase, usually through ValueExpression.setValue(...). The problem resides in we need to update only the relevant bean involved in f:validateWholeBean and keep all other objects intact, so there is a visitTree invocations to apply it in the proper context (remember datatable rows can be problematic). So I guess there is some manipulation in the ELResolver chain to do this. f:validateBean has some code that helps a bit (get ValueReference), but I still don't get the right combination. The documentation in the spec is clear, it is just I don't get how make this detail work in a consistent way. The rule is how to be sure only the content of the cloned object is updated without affect anything from the model (which should be updated in update model phase). Of course it could be done parsing each EL expression and applying only those with the same "reference", but that is seen as a "last resource" scenario.

> Implement f:validateWholeBean
> -----------------------------
>
>                 Key: MYFACES-4109
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4109
>             Project: MyFaces Core
>          Issue Type: New Feature
>          Components: JSR-372
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>
> Implement f:validateWholeBean as described in the spec javadoc. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)