You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2017/09/12 15:45:46 UTC

svn commit: r1808127 - /myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/validate/ValidateWholeBeanComponent.java

Author: tandraschko
Date: Tue Sep 12 15:45:45 2017
New Revision: 1808127

URL: http://svn.apache.org/viewvc?rev=1808127&view=rev
Log:
MYFACES-4149 add disabled attribute to f:validateWholeBean

Modified:
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/validate/ValidateWholeBeanComponent.java

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/validate/ValidateWholeBeanComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/validate/ValidateWholeBeanComponent.java?rev=1808127&r1=1808126&r2=1808127&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/validate/ValidateWholeBeanComponent.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/component/validate/ValidateWholeBeanComponent.java Tue Sep 12 15:45:45 2017
@@ -62,9 +62,8 @@ public class ValidateWholeBeanComponent
         Boolean enabled = WebConfigParamUtils.getBooleanInitParameter(context.getExternalContext(), 
                 BeanValidator.ENABLE_VALIDATE_WHOLE_BEAN_PARAM_NAME, Boolean.FALSE);
         
-        if (Boolean.TRUE.equals(enabled))
+        if (Boolean.TRUE.equals(enabled) && !isDisabled())
         {
-            
             //Install WholeBeanValidator
             Validator[] validators = this.getValidators();
             if (validators != null && validators.length > 0)
@@ -96,8 +95,20 @@ public class ValidateWholeBeanComponent
         getStateHelper().put(PropertyKeys.validationGroups, validationGroups );
     }
     
+    @JSFProperty(defaultValue="false")
+    public boolean isDisabled()
+    {
+        return (Boolean) getStateHelper().eval(PropertyKeys.disabled, false);
+    }
+    
+    public void setDisabled(boolean disabled)
+    {
+        getStateHelper().put(PropertyKeys.disabled, disabled);
+    }
+    
     enum PropertyKeys
     {
-        validationGroups
+        validationGroups,
+        disabled
     }
 }