1 /**
2 * Copyright 2005-2015 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.krad.datadictionary.uif;
17
18 import org.kuali.rice.krad.datadictionary.DictionaryBean;
19 import org.kuali.rice.krad.uif.lifecycle.initialize.PopulateComponentFromExpressionGraphTask;
20 import org.kuali.rice.krad.uif.lifecycle.initialize.PopulateReplacersAndModifiersFromExpressionGraphTask;
21
22 import java.util.Map;
23
24 /**
25 * Marks any class that can be configured through the UIF dictionary
26 *
27 * <p>
28 * Indicates behavior that must be supported by an Class that can be configured through
29 * the UIF dictionary, such as property expressions.
30 * </p>
31 *
32 * @author Kuali Rice Team (rice.collab@kuali.org)
33 */
34 public interface UifDictionaryBean extends DictionaryBean {
35
36 /**
37 * Map of expressions that were configured for the object's graph
38 *
39 * <p>
40 * During processing of the UIF configuration, expressions are pulled out and placed into this
41 * map for the component graph. A component graph contains the component and all one to one
42 * nested components (but not those that are contained in collections, each of these begins
43 * another graph). The expressions are placed at the root component level instead of the actual
44 * nested component for handling of nested property configuration and overridding
45 * </p>
46 *
47 * <p>
48 * The expression graph map key gives the property name (possibly nested) the expression was
49 * configured on, and the map value gives the expression. During the view lifecycle, see
50 * {@link PopulateComponentFromExpressionGraphTask} and
51 * {@link PopulateReplacersAndModifiersFromExpressionGraphTask}, the expressions are moved to
52 * the {@link #getPropertyExpressions()} map for the configurable they should be evaluated on
53 * </p>
54 *
55 * @return Map<String, String> map of expressions contained on the configurable graph
56 */
57 public Map<String, String> getExpressionGraph();
58
59 /**
60 * Setter for the map of expressions contained on the configurable graph
61 *
62 * @param expressionGraph
63 */
64 public void setExpressionGraph(Map<String, String> expressionGraph);
65
66 /**
67 * Map of expressions that should be evaluated to conditionally set a property on the component
68 *
69 * <p>
70 * When configuring a component property through XML an expression can be given using the @{} placeholder. During
71 * the loading of the XML any such expressions are captured and placed into this Map, with the property they apply
72 * to set as the Map key. The expressions are then evaluated during the apply model phase and the result is set as
73 * the property value.
74 * </p>
75 *
76 * <p>
77 * Note after the expression is picked up, the property configuration is removed. Thus the property in the
78 * component will only have its default object value until the expression is evaluated
79 * </p>
80 *
81 * @return Map<String, String> map of expressions where key is property name and value is expression to evaluate
82 */
83 public Map<String, String> getPropertyExpressions();
84
85 /**
86 * Setter for the Map of property expressions
87 *
88 * @param propertyExpressions
89 */
90 public void setPropertyExpressions(Map<String, String> propertyExpressions);
91
92 /**
93 * Returns the expression configured for the property with the given name
94 * @param propertyName property name
95 *
96 * @return String expression for property or null if expression is not configured
97 * @see org.kuali.rice.krad.uif.component.Component#getPropertyExpressions()
98 */
99 public String getPropertyExpression(String propertyName);
100 }