public class UifViewBeanWrapper extends org.springframework.beans.BeanWrapperImpl
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 |
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 PropertyEditor |
findEditorForPropertyName(String propertyName)
Finds a property editor for the given propert name, checking for a custom registered editor and editors
by type.
|
protected org.springframework.beans.BeanWrapperImpl |
getBeanWrapperForPropertyPath(String propertyPath)
Overridden to copy property editor registration to the new bean wrapper.
|
Class<?> |
getPropertyType(String propertyName) |
Object |
getPropertyValue(String propertyName)
Overridden to register any property editor for the property before the value is pulled.
|
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.
|
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.
|
convertForProperty, getAutoGrowCollectionLimit, getNestedPath, getPropertyDescriptor, getPropertyDescriptorInternal, getPropertyDescriptors, getPropertyTypeDescriptor, getRootClass, getRootInstance, getSecurityContext, getWrappedClass, getWrappedInstance, isAutoGrowNestedPaths, isReadableProperty, isWritableProperty, newNestedBeanWrapper, 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 PropertyEditor findEditorForPropertyName(String propertyName)
propertyName
- name of the property to get editor forpublic Class<?> getPropertyType(String propertyName) throws org.springframework.beans.BeansException
getPropertyType
in interface org.springframework.beans.PropertyAccessor
getPropertyType
in class org.springframework.beans.BeanWrapperImpl
org.springframework.beans.BeansException
protected org.springframework.beans.BeanWrapperImpl getBeanWrapperForPropertyPath(String propertyPath)
getBeanWrapperForPropertyPath
in class org.springframework.beans.BeanWrapperImpl
public Object getPropertyValue(String propertyName) throws org.springframework.beans.BeansException
getPropertyValue
in interface org.springframework.beans.PropertyAccessor
getPropertyValue
in class org.springframework.beans.BeanWrapperImpl
org.springframework.beans.BeansException
public 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.
setPropertyValue
in interface org.springframework.beans.PropertyAccessor
setPropertyValue
in class org.springframework.beans.BeanWrapperImpl
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.
setPropertyValue
in interface org.springframework.beans.PropertyAccessor
setPropertyValue
in class org.springframework.beans.BeanWrapperImpl
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 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 propertyCopyright © 2005–2014 The Kuali Foundation. All rights reserved.