Class UifViewBeanWrapper

java.lang.Object
org.springframework.beans.PropertyEditorRegistrySupport
org.springframework.beans.TypeConverterSupport
org.springframework.beans.AbstractPropertyAccessor
org.springframework.beans.AbstractNestablePropertyAccessor
org.springframework.beans.BeanWrapperImpl
org.kuali.rice.krad.web.bind.UifBeanWrapper
org.kuali.rice.krad.web.bind.UifViewBeanWrapper
All Implemented Interfaces:
org.springframework.beans.BeanWrapper, org.springframework.beans.ConfigurablePropertyAccessor, org.springframework.beans.PropertyAccessor, org.springframework.beans.PropertyEditorRegistry, org.springframework.beans.TypeConverter

public class UifViewBeanWrapper extends UifBeanWrapper
Class is a top level BeanWrapper for a UIF View Model.

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

Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.beans.AbstractNestablePropertyAccessor

    org.springframework.beans.AbstractNestablePropertyAccessor.PropertyHandler
  • Field Summary

    Fields inherited from interface org.springframework.beans.PropertyAccessor

    NESTED_PROPERTY_SEPARATOR, NESTED_PROPERTY_SEPARATOR_CHAR, PROPERTY_KEY_PREFIX, PROPERTY_KEY_PREFIX_CHAR, PROPERTY_KEY_SUFFIX, PROPERTY_KEY_SUFFIX_CHAR
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    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
    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
    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
    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
    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(String propertyName, Object value)
    Overridden to perform processing before and after the value is set.
    void
    setPropertyValue(org.springframework.beans.PropertyValue pv)
    Overridden to perform processing before and after the value is set.

    Methods inherited from class org.kuali.rice.krad.web.bind.UifBeanWrapper

    getPropertyValue, getRootBeanWrapper, newNestedPropertyAccessor, setRootBeanWrapper

    Methods inherited from class org.springframework.beans.BeanWrapperImpl

    convertForProperty, createNotWritablePropertyException, getLocalPropertyHandler, getPropertyDescriptor, getPropertyDescriptors, getSecurityContext, setBeanInstance, setIntrospectionClass, setSecurityContext, setWrappedInstance

    Methods inherited from class org.springframework.beans.AbstractNestablePropertyAccessor

    convertForProperty, getAutoGrowCollectionLimit, getFinalPath, getNestedPath, getPropertyHandler, getPropertyType, getPropertyTypeDescriptor, getPropertyValue, getRootClass, getRootInstance, getWrappedClass, getWrappedInstance, isReadableProperty, isWritableProperty, setAutoGrowCollectionLimit, setPropertyValue, setWrappedInstance, toString

    Methods inherited from class org.springframework.beans.AbstractPropertyAccessor

    isAutoGrowNestedPaths, isExtractOldValueForEditor, setAutoGrowNestedPaths, setExtractOldValueForEditor, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues

    Methods inherited from class org.springframework.beans.TypeConverterSupport

    convertIfNecessary, convertIfNecessary, convertIfNecessary, convertIfNecessary

    Methods inherited from class org.springframework.beans.PropertyEditorRegistrySupport

    copyCustomEditorsTo, copyDefaultEditorsTo, findCustomEditor, getConversionService, getDefaultEditor, guessPropertyTypeFromEditors, hasCustomEditorForElement, overrideDefaultEditor, registerCustomEditor, registerCustomEditor, registerDefaultEditors, setConversionService, useConfigValueEditors

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.springframework.beans.BeanWrapper

    getAutoGrowCollectionLimit, getWrappedClass, getWrappedInstance, setAutoGrowCollectionLimit

    Methods inherited from interface org.springframework.beans.ConfigurablePropertyAccessor

    getConversionService, isAutoGrowNestedPaths, isExtractOldValueForEditor, setAutoGrowNestedPaths, setConversionService, setExtractOldValueForEditor

    Methods inherited from interface org.springframework.beans.PropertyAccessor

    getPropertyType, getPropertyTypeDescriptor, isReadableProperty, isWritableProperty, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues

    Methods inherited from interface org.springframework.beans.PropertyEditorRegistry

    findCustomEditor, registerCustomEditor, registerCustomEditor

    Methods inherited from interface org.springframework.beans.TypeConverter

    convertIfNecessary, convertIfNecessary, convertIfNecessary, convertIfNecessary
  • Constructor Details

  • Method Details

    • getPropertyValue

      protected Object getPropertyValue(String propertyName, boolean autoGrowNestedPaths)
      Override to register property editors from the view before the value is retrieved. Returns the value for the given property growing nested paths depending on the parameter.
      Overrides:
      getPropertyValue in class UifBeanWrapper
      Parameters:
      propertyName - name of the property to get value for
      autoGrowNestedPaths - whether nested paths should be grown (initialized if null)
      Returns:
      value for property
    • registerEditorFromView

      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.
      Parameters:
      propertyName - name of the property to find field and editor for
    • setPropertyValue

      public void setPropertyValue(org.springframework.beans.PropertyValue pv) throws org.springframework.beans.BeansException
      Overridden to perform processing before and after the value is set.

      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.
      Specified by:
      setPropertyValue in interface org.springframework.beans.PropertyAccessor
      Overrides:
      setPropertyValue in class UifBeanWrapper
      Throws:
      org.springframework.beans.BeansException
    • setPropertyValue

      public void setPropertyValue(String propertyName, Object value) throws org.springframework.beans.BeansException
      Overridden to perform processing before and after the value is set.

      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.
      Specified by:
      setPropertyValue in interface org.springframework.beans.PropertyAccessor
      Overrides:
      setPropertyValue in class UifBeanWrapper
      Throws:
      org.springframework.beans.BeansException
    • checkPropertyBindingAccess

      protected boolean checkPropertyBindingAccess(String propertyName)
      Determines whether request binding is allowed for the given property name/path.

      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.

      Parameters:
      propertyName - name/path of the property to check binding access for
      Returns:
      boolean true if binding access is allowed, false if not allowed
    • checkBindingAnnotationsInPath

      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).

      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.

      Parameters:
      propertyPath - path to look for annotations
      Returns:
      Boolean true if an annotation is found and the access is allowed, false if an annotation is found and the access is protected, null if no annotations where found in the path
    • annotationMatchesMethodToCalls

      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.
      Parameters:
      annotationMethodToCalls - array of request accessible methods to call to check against
      methodToCall - method to call of the request
      Returns:
      boolean true if one of the annotation methods to call match, false if none match
    • annotationMatchesRequestMethod

      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.
      Parameters:
      annotationMethods - array of request methods to check
      requestMethod - method of the request to match on
      Returns:
      boolean true if one of the annotation methods match, false if none match
    • processValueBeforeSet

      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.
      Parameters:
      propertyName - name of the property
      value - value of the property to process
      Returns:
      updated (possibly) property value
    • decryptValueIfNecessary

      protected String decryptValueIfNecessary(String propertyName, String propertyValue)
      If the given property name is secure, decrypts the value by calling the encryption service.
      Parameters:
      propertyName - name of the property
      propertyValue - value of the property
      Returns:
      String decrypted property value (or original value if not secure)
    • isSecure

      protected boolean isSecure(Class<?> wrappedClass, String propertyPath)
      Checks whether the given property is secure.
      Parameters:
      wrappedClass - class the property is associated with
      propertyPath - path to the property
      Returns:
      boolean true if the property is secure, false if not
    • getPropertyAccessorForPropertyPath

      protected org.springframework.beans.BeanWrapperImpl getPropertyAccessorForPropertyPath(String propertyPath)
      Overridden to copy property editor registration to the new bean wrapper.

      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

      Overrides:
      getPropertyAccessorForPropertyPath in class UifBeanWrapper