Class DictionaryBeanFactoryPostProcessor

java.lang.Object
org.kuali.rice.krad.datadictionary.DictionaryBeanFactoryPostProcessor

public class DictionaryBeanFactoryPostProcessor extends Object
Post processor for the data dictionary bean factory

The 'driver' for other post processors. Essentially this iterates through each bean and its properties, making calls to the message and expression processors

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

    Constructors
    Constructor
    Description
    DictionaryBeanFactoryPostProcessor(DataDictionary dataDictionary, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
    Constructs a new processor for the given data dictionary and bean factory
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.springframework.beans.factory.config.BeanDefinition
    Returns the given value as a bean definition (parsing from holder if necessary)
    protected String
    Gets the bean name from the given value which is assumed to be a bean definition holder
    Retrieves the data dictionary service using the KRAD service locator
    protected String
    Determines whether the given value is of String type and if so returns the string value
    protected boolean
    Indicate whether the given value is a bean definition (or holder)
    protected boolean
    Indicate whether the given value is a collection
    protected boolean
    Indicate whether the given value is a string or holds a string
    void
    Iterates through all beans in the factory and invokes processing of root bean definitions
    protected String
    processArrayStringPropertyValue(String propertyName, Object[] propertyValue, String elementValue, int elementIndex, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors)
    Invokes the processors to handle an array string value (which may be changed)
    protected void
    processBeanProperties(org.springframework.beans.factory.config.BeanDefinition beanDefinition, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
    Iterates through the properties defined for the bean definition and invokes helper methods to process the property value
    protected String
    processListStringPropertyValue(String propertyName, List<?> propertyValue, String elementValue, int elementIndex, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors)
    Invokes the processors to handle an list string value (which may be changed)
    protected String
    processMapStringPropertyValue(String propertyName, Map<?,?> propertyValue, String elementValue, Object elementKey, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors)
    Invokes the processors to handle an map string value (which may be changed)
    void
    processNestedBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition, String nestedPropertyPath, boolean isCollectionBean, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
    Invokes the processors to handle the given nested bean definition
    protected void
    processRootBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition)
    Invokes processors to handle the root bean definition then processes the bean properties
    protected String
    processSetStringPropertyValue(String propertyName, Set<?> propertyValue, String elementValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors)
    Invokes the processors to handle an set string value (which may be changed)
    protected String
    processStringPropertyValue(String propertyName, String propertyValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
    Invokes the processors to handle the string value (which may be changed)
    protected void
    visitArray(Object array, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
    Iterates through the array values and calls helpers to process the value
    protected void
    visitCollection(Object value, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
    Determines what kind of collection (or array) the given value is and call handlers based on the determined type
    protected void
    visitList(List<?> listVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
    Iterates through the list values and calls helpers to process the value
    protected void
    visitMap(Map<?,?> mapVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
    Iterates through the map values and calls helpers to process the value
    protected Object
    visitPropertyValue(String propertyName, Object propertyValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
    Determines if the property value is a bean or collection, and calls the appropriate helper method to process further.
    protected void
    visitSet(Set setVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
    Iterates through the set values and calls helpers to process the value

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DictionaryBeanFactoryPostProcessor

      public DictionaryBeanFactoryPostProcessor(DataDictionary dataDictionary, org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
      Constructs a new processor for the given data dictionary and bean factory
      Parameters:
      dataDictionary - data dictionary instance that contains the bean factory
      beanFactory - bean factory to process
  • Method Details

    • postProcessBeanFactory

      public void postProcessBeanFactory() throws org.springframework.beans.BeansException
      Iterates through all beans in the factory and invokes processing of root bean definitions
      Throws:
      org.springframework.beans.BeansException
    • processRootBeanDefinition

      protected void processRootBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition)
      Invokes processors to handle the root bean definition then processes the bean properties
      Parameters:
      beanName - name of the bean within the factory
      beanDefinition - root bean definition to process
    • processNestedBeanDefinition

      public void processNestedBeanDefinition(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition, String nestedPropertyPath, boolean isCollectionBean, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
      Invokes the processors to handle the given nested bean definition

      A check is also made to determine if the nested bean has a non-generated id which is not registered in the factory, if so the bean is added as a registered bean (so it can be found by id)

      Parameters:
      beanName - name of the nested bean definition in the bean factory
      beanDefinition - nested bean definition to process
      nestedPropertyPath - the property path to the nested bean from the parent bean definition
      isCollectionBean - indicates whether the nested bean is in a collection, if so a different handler method is called on the processors
      nestedBeanStack - the stack of bean containers(those beans which contain the bean)
    • processStringPropertyValue

      protected String processStringPropertyValue(String propertyName, String propertyValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
      Invokes the processors to handle the string value (which may be changed)
      Parameters:
      propertyName - name of the property that is being processed
      propertyValue - the string property value to process
      nestedBeanStack - the stack of bean containers, including the bean that contains the property
      Returns:
      String new property value (possibly modified by processors)
    • processArrayStringPropertyValue

      protected String processArrayStringPropertyValue(String propertyName, Object[] propertyValue, String elementValue, int elementIndex, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors)
      Invokes the processors to handle an array string value (which may be changed)
      Parameters:
      propertyName - name of the property that is being processed
      propertyValue - the array which contains the string
      elementValue - the string element value
      elementIndex - the index of the string within the array
      nestedBeanStack - the stack of bean containers, including the bean that contains the property
      Returns:
      String new property value (possibly modified by processors)
    • processListStringPropertyValue

      protected String processListStringPropertyValue(String propertyName, List<?> propertyValue, String elementValue, int elementIndex, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors)
      Invokes the processors to handle an list string value (which may be changed)
      Parameters:
      propertyName - name of the property that is being processed
      propertyValue - the list which contains the string
      elementValue - the string element value
      elementIndex - the index of the string within the list
      nestedBeanStack - the stack of bean containers, including the bean that contains the property
      Returns:
      String new property value (possibly modified by processors)
    • processSetStringPropertyValue

      protected String processSetStringPropertyValue(String propertyName, Set<?> propertyValue, String elementValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors)
      Invokes the processors to handle an set string value (which may be changed)
      Parameters:
      propertyName - name of the property that is being processed
      propertyValue - the set which contains the string
      elementValue - the string element value
      nestedBeanStack - the stack of bean containers, including the bean that contains the property
      Returns:
      String new property value (possibly modified by processors)
    • processMapStringPropertyValue

      protected String processMapStringPropertyValue(String propertyName, Map<?,?> propertyValue, String elementValue, Object elementKey, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack, List<DictionaryBeanProcessor> beanProcessors)
      Invokes the processors to handle an map string value (which may be changed)
      Parameters:
      propertyName - name of the property that is being processed
      propertyValue - the map which contains the string
      elementValue - the string element value
      elementKey - the key for the string within the map
      nestedBeanStack - the stack of bean containers, including the bean that contains the property
      Returns:
      String new property value (possibly modified by processors)
    • processBeanProperties

      protected void processBeanProperties(org.springframework.beans.factory.config.BeanDefinition beanDefinition, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
      Iterates through the properties defined for the bean definition and invokes helper methods to process the property value
      Parameters:
      beanDefinition - bean definition whose properties will be processed
      nestedBeanStack - stack of beans which contain the given bean
    • visitPropertyValue

      protected Object visitPropertyValue(String propertyName, Object propertyValue, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
      Determines if the property value is a bean or collection, and calls the appropriate helper method to process further. Ultimately this invokes the processors to modify the property value if necessary
      Parameters:
      propertyName - name for the property being processed
      propertyValue - value for the property to process
      nestedBeanStack - stack of beans which contain the property
      Returns:
      Object the new property value (which may be modified0
    • visitCollection

      protected void visitCollection(Object value, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
      Determines what kind of collection (or array) the given value is and call handlers based on the determined type
      Parameters:
      value - collection value to process
      propertyName - name of the property which has the collection value
      nestedBeanStack - stack of bean containers which contains the collection property
    • visitArray

      protected void visitArray(Object array, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
      Iterates through the array values and calls helpers to process the value
      Parameters:
      array - the array to process
      propertyName - name of the property which has the array value
      nestedBeanStack - stack of bean containers which contains the array property
    • visitList

      protected void visitList(List<?> listVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
      Iterates through the list values and calls helpers to process the value
      Parameters:
      listVal - the list to process
      propertyName - name of the property which has the list value
      nestedBeanStack - stack of bean containers which contains the list property
    • visitSet

      protected void visitSet(Set setVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
      Iterates through the set values and calls helpers to process the value
      Parameters:
      setVal - the set to process
      propertyName - name of the property which has the set value
      nestedBeanStack - stack of bean containers which contains the set property
    • visitMap

      protected void visitMap(Map<?,?> mapVal, String propertyName, Stack<org.springframework.beans.factory.config.BeanDefinitionHolder> nestedBeanStack)
      Iterates through the map values and calls helpers to process the value
      Parameters:
      mapVal - the set to process
      propertyName - name of the property which has the map value
      nestedBeanStack - stack of bean containers which contains the map property
    • isStringValue

      protected boolean isStringValue(Object value)
      Indicate whether the given value is a string or holds a string
      Parameters:
      value - value to test
      Returns:
      boolean true if the value is a string, false if not
    • getString

      protected String getString(Object value)
      Determines whether the given value is of String type and if so returns the string value
      Parameters:
      value - object value to check
      Returns:
      String string value for object or null if object is not a string type
    • isBeanDefinitionValue

      protected boolean isBeanDefinitionValue(Object value)
      Indicate whether the given value is a bean definition (or holder)
      Parameters:
      value - value to test
      Returns:
      boolean true if the value is a bean definition, false if not
    • getBeanDefinition

      protected org.springframework.beans.factory.config.BeanDefinition getBeanDefinition(Object value)
      Returns the given value as a bean definition (parsing from holder if necessary)
      Parameters:
      value - value to convert
      Returns:
      BeanDefinition converted bean definition
    • getBeanName

      protected String getBeanName(Object value)
      Gets the bean name from the given value which is assumed to be a bean definition holder
      Parameters:
      value - value retrieve bean name from
      Returns:
      String bean name, or null if value is not a bean definition holder
    • isCollectionValue

      protected boolean isCollectionValue(Object value)
      Indicate whether the given value is a collection
      Parameters:
      value - value to test
      Returns:
      boolean true if the value is a collection, false if not
    • getDataDictionaryService

      protected DataDictionaryService getDataDictionaryService()
      Retrieves the data dictionary service using the KRAD service locator
      Returns:
      DataDictionaryService instance