public class UifViewBeanWrapper extends UifBeanWrapper
Registers custom property editors configured on the field associated with the property name for which
we are getting or setting a value. In addition determines if the field requires encryption and if so applies
the UifEncryptionPropertyEditorWrapper
Constructor and Description |
---|
UifViewBeanWrapper(ViewModel model,
UifBeanPropertyBindingResult bindingResult) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
annotationMatchesMethodToCalls(String[] annotationMethodToCalls,
String methodToCall)
Indicates whether one of the given request accessible methods to call in the given array matches the
actual methodToCall of the request.
|
protected boolean |
annotationMatchesRequestMethod(org.springframework.web.bind.annotation.RequestMethod[] annotationMethods,
String requestMethod)
Indicates whether one of the given request methods in the given array matches the actual method of
the request.
|
protected Boolean |
checkBindingAnnotationsInPath(String propertyPath)
Determines whether one of the binding annotations is present within the given property path, and if
so returns whether access should be granted based on those annotation(s).
|
protected boolean |
checkPropertyBindingAccess(String propertyName)
Determines whether request binding is allowed for the given property name/path.
|
protected String |
decryptValueIfNecessary(String propertyName,
String propertyValue)
If the given property name is secure, decrypts the value by calling the encryption service.
|
protected org.springframework.beans.BeanWrapperImpl |
getBeanWrapperForPropertyPath(String propertyPath)
Overridden to copy property editor registration to the new bean wrapper.
|
protected Object |
getPropertyValue(String propertyName,
boolean autoGrowNestedPaths)
Override to register property editors from the view before the value is retrieved.
|
protected boolean |
isSecure(Class<?> wrappedClass,
String propertyPath)
Checks whether the given property is secure.
|
protected Object |
processValueBeforeSet(String propertyName,
Object value)
Registers any custom property editor for the property name/path, converts empty string values to null, and
calls helper method to decrypt secure values.
|
protected void |
registerEditorFromView(String propertyName)
Attempts to find a corresponding data field for the given property name in the current view or previous view,
then if the field has a property editor configured it is registered with the property editor registry to use
for this property.
|
void |
setPropertyValue(org.springframework.beans.PropertyValue pv)
Overridden to perform processing before and after the value is set.
|
void |
setPropertyValue(String propertyName,
Object value)
Overridden to perform processing before and after the value is set.
|
getPropertyValue, getRootBeanWrapper, newNestedBeanWrapper, setRootBeanWrapper
convertForProperty, getAutoGrowCollectionLimit, getNestedPath, getPropertyDescriptor, getPropertyDescriptorInternal, getPropertyDescriptors, getPropertyType, getPropertyTypeDescriptor, getRootClass, getRootInstance, getSecurityContext, getWrappedClass, getWrappedInstance, isAutoGrowNestedPaths, isReadableProperty, isWritableProperty, setAutoGrowCollectionLimit, setAutoGrowNestedPaths, setIntrospectionClass, setSecurityContext, setWrappedInstance, setWrappedInstance, toString
isExtractOldValueForEditor, setExtractOldValueForEditor, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues
convertIfNecessary, convertIfNecessary, convertIfNecessary
copyCustomEditorsTo, copyDefaultEditorsTo, findCustomEditor, getConversionService, getDefaultEditor, guessPropertyTypeFromEditors, hasCustomEditorForElement, isSharedEditor, overrideDefaultEditor, registerCustomEditor, registerCustomEditor, registerDefaultEditors, registerSharedEditor, setConversionService, useConfigValueEditors
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getConversionService, isExtractOldValueForEditor, setConversionService, setExtractOldValueForEditor
setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues
public UifViewBeanWrapper(ViewModel model, UifBeanPropertyBindingResult bindingResult)
protected Object getPropertyValue(String propertyName, boolean autoGrowNestedPaths)
getPropertyValue
in class UifBeanWrapper
propertyName
- name of the property to get value forautoGrowNestedPaths
- whether nested paths should be grown (initialized if null)protected void registerEditorFromView(String propertyName)
propertyName
- name of the property to find field and editor forpublic void setPropertyValue(org.springframework.beans.PropertyValue pv) throws org.springframework.beans.BeansException
First binding security is checked to determine whether the path allows binding. Next, access security is checked to determine whether the value needs decrypted. Finally, if change tracking is enabled, the original value is compared with the new for indicating a modified path.
Override to set auto grow to true for setting property values.setPropertyValue
in interface org.springframework.beans.PropertyAccessor
setPropertyValue
in class UifBeanWrapper
org.springframework.beans.BeansException
public void setPropertyValue(String propertyName, Object value) throws org.springframework.beans.BeansException
First binding security is checked to determine whether the path allows binding. Next, access security is checked to determine whether the value needs decrypted. Finally, if change tracking is enabled, the original value is compared with the new for indicating a modified path.
Override to set auto grow to true for setting property values.setPropertyValue
in interface org.springframework.beans.PropertyAccessor
setPropertyValue
in class UifBeanWrapper
org.springframework.beans.BeansException
protected boolean checkPropertyBindingAccess(String propertyName)
Binding access is determined by default based on the view's post metadata. A set of
accessible binding paths (populated during the view lifecycle) is maintained within this data.
Overrides can be specified using the annotations RequestProtected
and RequestAccessible
.
If the path is not accessible, it is recorded in the binding results suppressed fields. Controller methods can accept the binding result and further handle these properties if necessary.
propertyName
- name/path of the property to check binding access forprotected Boolean checkBindingAnnotationsInPath(String propertyPath)
Binding annotations may occur anywhere in the property path. For example, if the path is 'object.field1', a binding annotation may be present on the 'object' property or the 'field1' property. If multiple annotations are found in the path, the annotation at the deepest level is taken. If both the protected and accessible annotation are found at the same level, the protected access is used.
propertyPath
- path to look for annotationsprotected boolean annotationMatchesMethodToCalls(String[] annotationMethodToCalls, String methodToCall)
annotationMethodToCalls
- array of request accessible methods to call to check againstmethodToCall
- method to call of the requestprotected boolean annotationMatchesRequestMethod(org.springframework.web.bind.annotation.RequestMethod[] annotationMethods, String requestMethod)
annotationMethods
- array of request methods to checkrequestMethod
- method of the request to match onprotected Object processValueBeforeSet(String propertyName, Object value)
propertyName
- name of the propertyvalue
- value of the property to processprotected String decryptValueIfNecessary(String propertyName, String propertyValue)
propertyName
- name of the propertypropertyValue
- value of the propertyprotected boolean isSecure(Class<?> wrappedClass, String propertyPath)
wrappedClass
- class the property is associated withpropertyPath
- path to the propertyprotected org.springframework.beans.BeanWrapperImpl getBeanWrapperForPropertyPath(String propertyPath)
This is necessary because spring only copies over the editors when a new bean wrapper is created. The wrapper is then cached and use for subsequent calls. But the get calls could bring in new custom editors we need to copy.
Override to set auto grown on the nested bean wrapper to the setting of the root bean wrapper.This is necessary because the nested bean wrapper could have been cached, and its auto-grow setting reflect an earler get or set call
getBeanWrapperForPropertyPath
in class UifBeanWrapper
Copyright © 2005–2015 The Kuali Foundation. All rights reserved.