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.uif;
017
018import org.kuali.rice.krad.datadictionary.DictionaryBean;
019import org.kuali.rice.krad.uif.lifecycle.initialize.PopulateComponentFromExpressionGraphTask;
020import org.kuali.rice.krad.uif.lifecycle.initialize.PopulateReplacersAndModifiersFromExpressionGraphTask;
021
022import java.util.Map;
023
024/**
025 * Marks any class that can be configured through the UIF dictionary
026 *
027 * <p>
028 * Indicates behavior that must be supported by an Class that can be configured through
029 * the UIF dictionary, such as property expressions.
030 * </p>
031 *
032 * @author Kuali Rice Team (rice.collab@kuali.org)
033 */
034public interface UifDictionaryBean extends DictionaryBean {
035
036    /**
037     * Map of expressions that were configured for the object's graph
038     * 
039     * <p>
040     * During processing of the UIF configuration, expressions are pulled out and placed into this
041     * map for the component graph. A component graph contains the component and all one to one
042     * nested components (but not those that are contained in collections, each of these begins
043     * another graph). The expressions are placed at the root component level instead of the actual
044     * nested component for handling of nested property configuration and overridding
045     * </p>
046     * 
047     * <p>
048     * The expression graph map key gives the property name (possibly nested) the expression was
049     * configured on, and the map value gives the expression. During the view lifecycle, see
050     * {@link PopulateComponentFromExpressionGraphTask} and
051     * {@link PopulateReplacersAndModifiersFromExpressionGraphTask}, the expressions are moved to
052     * the {@link #getPropertyExpressions()} map for the configurable they should be evaluated on
053     * </p>
054     * 
055     * @return Map<String, String> map of expressions contained on the configurable graph
056     */
057    public Map<String, String> getExpressionGraph();
058
059    /**
060     * Setter for the map of expressions contained on the configurable graph
061     *
062     * @param expressionGraph
063     */
064    public void setExpressionGraph(Map<String, String> expressionGraph);
065
066    /**
067     * Map of expressions that should be evaluated to conditionally set a property on the component
068     *
069     * <p>
070     * When configuring a component property through XML an expression can be given using the @{} placeholder. During
071     * the loading of the XML any such expressions are captured and placed into this Map, with the property they apply
072     * to set as the Map key. The expressions are then evaluated during the apply model phase and the result is set as
073     * the property value.
074     * </p>
075     *
076     * <p>
077     * Note after the expression is picked up, the property configuration is removed. Thus the property in the
078     * component will only have its default object value until the expression is evaluated
079     * </p>
080     *
081     * @return Map<String, String> map of expressions where key is property name and value is expression to evaluate
082     */
083    public Map<String, String> getPropertyExpressions();
084
085    /**
086     * Setter for the Map of property expressions
087     *
088     * @param propertyExpressions
089     */
090    public void setPropertyExpressions(Map<String, String> propertyExpressions);
091
092    /**
093     * Returns the expression configured for the property with the given name
094     * @param propertyName property name
095     *
096     * @return String expression for property or null if expression is not configured
097     * @see org.kuali.rice.krad.uif.component.Component#getPropertyExpressions()
098     */
099    public String getPropertyExpression(String propertyName);
100}