001/**
002 * Copyright 2005-2018 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.datadictionary;
017
018import org.springframework.beans.factory.config.BeanDefinition;
019import org.springframework.beans.factory.config.BeanDefinitionHolder;
020
021import java.util.List;
022import java.util.Map;
023import java.util.Set;
024import java.util.Stack;
025
026/**
027 * API for classes that perform post processing of the dictionary bean definitions
028 *
029 * @author Kuali Rice Team (rice.collab@kuali.org)
030 */
031public interface DictionaryBeanProcessor {
032
033    /**
034     * Invoked to process a root bean definition (a root bean definition is a top level bean)
035     *
036     * @param beanName name of the bean within the factory
037     * @param beanDefinition bean definition to process
038     */
039    public void processRootBeanDefinition(String beanName, BeanDefinition beanDefinition);
040
041    /**
042     * Invoked to process a nested bean definition (a bean definition that is a property value of another
043     * bean definition)
044     *
045     * @param beanName name of the bean within the factory
046     * @param beanDefinition bean definition to process
047     * @param propertyName the name of the property which has the bean definition value
048     * @param nestedBeanStack the stack of beans which contain the given bean
049     */
050    public void processNestedBeanDefinition(String beanName, BeanDefinition beanDefinition, String propertyName,
051            Stack<BeanDefinitionHolder> nestedBeanStack);
052
053    /**
054     * Invoked to process a string property value (straight property value, not a string within a collection)
055     *
056     * @param propertyName name of the property whose string value is being processed
057     * @param propertyValue string value for the property
058     * @return String new property value (possibly modified)
059     */
060    public String processStringPropertyValue(String propertyName, String propertyValue,
061            Stack<BeanDefinitionHolder> nestedBeanStack);
062
063    /**
064     * Invoked to process a collection value that is a bean definition
065     *
066     * @param beanName name of the bean within the factory
067     * @param beanDefinition bean definition within the collection to process
068     * @param propertyName the name of the property which has the collection value
069     * @param nestedBeanStack the stack of beans which contain the given collection (and collection bean)
070     */
071    public void processCollectionBeanDefinition(String beanName, BeanDefinition beanDefinition, String propertyName,
072            Stack<BeanDefinitionHolder> nestedBeanStack);
073
074    /**
075     * Invokes the processors to handle an array string value (which may be changed)
076     *
077     * @param propertyName name of the property that is being processed
078     * @param propertyValue the array which contains the string
079     * @param elementValue the string element value
080     * @param elementIndex the index of the string within the array
081     * @param nestedBeanStack the stack of bean containers, including the bean that contains the property
082     * @return String new property value (possibly modified by processors)
083     */
084    public String processArrayStringPropertyValue(String propertyName, Object[] propertyValue, String elementValue,
085            int elementIndex, Stack<BeanDefinitionHolder> nestedBeanStack);
086
087    /**
088     * Invokes the processors to handle an list string value (which may be changed)
089     *
090     * @param propertyName name of the property that is being processed
091     * @param propertyValue the list which contains the string
092     * @param elementValue the string element value
093     * @param elementIndex the index of the string within the list
094     * @param nestedBeanStack the stack of bean containers, including the bean that contains the property
095     * @return String new property value (possibly modified by processors)
096     */
097    public String processListStringPropertyValue(String propertyName, List<?> propertyValue, String elementValue,
098            int elementIndex, Stack<BeanDefinitionHolder> nestedBeanStack);
099
100    /**
101     * Invokes the processors to handle an set string value (which may be changed)
102     *
103     * @param propertyName name of the property that is being processed
104     * @param propertyValue the set which contains the string
105     * @param elementValue the string element value
106     * @param nestedBeanStack the stack of bean containers, including the bean that contains the property
107     * @return String new property value (possibly modified by processors)
108     */
109    public String processSetStringPropertyValue(String propertyName, Set<?> propertyValue, String elementValue,
110            Stack<BeanDefinitionHolder> nestedBeanStack);
111
112    /**
113     * Invokes the processors to handle an map string value (which may be changed)
114     *
115     * @param propertyName name of the property that is being processed
116     * @param propertyValue the map which contains the string
117     * @param elementValue the string element value
118     * @param elementKey the key for the string within the map
119     * @param nestedBeanStack the stack of bean containers, including the bean that contains the property
120     * @return String new property value (possibly modified by processors)
121     */
122    public String processMapStringPropertyValue(String propertyName, Map<?, ?> propertyValue, String elementValue,
123            Object elementKey, Stack<BeanDefinitionHolder> nestedBeanStack);
124}