001/**
002 * Copyright 2005-2016 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.DictionaryBeanBase;
019
020import java.util.HashMap;
021import java.util.Map;
022
023/**
024 * Common base class for dictionary objects that can contain dynamic expressions within the
025 * property value
026 *
027 * <p>
028 * Should be extended by other classes to provide property expression support
029 * </p>
030 *
031 * @author Kuali Rice Team (rice.collab@kuali.org)
032 */
033public class UifDictionaryBeanBase extends DictionaryBeanBase implements UifDictionaryBean {
034
035    private Map<String, String> expressionGraph;
036    private Map<String, String> refreshExpressionGraph;
037    private Map<String, String> propertyExpressions;
038
039    public UifDictionaryBeanBase() {
040        expressionGraph = new HashMap<String, String>();
041        refreshExpressionGraph = new HashMap<String, String>();
042        propertyExpressions = new HashMap<String, String>();
043    }
044
045    /**
046     * {@inheritDoc}
047     */
048    @Override
049    public Map<String, String> getExpressionGraph() {
050        return expressionGraph;
051    }
052
053    /**
054     * {@inheritDoc}
055     */
056    @Override
057    public void setExpressionGraph(Map<String, String> expressionGraph) {
058        this.expressionGraph = expressionGraph;
059    }
060
061    /**
062     * @see org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean#getPropertyExpressions
063     */
064    public Map<String, String> getPropertyExpressions() {
065        return propertyExpressions;
066    }
067
068    /**
069     * @see org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean#setPropertyExpressions
070     */
071    public void setPropertyExpressions(Map<String, String> propertyExpressions) {
072        this.propertyExpressions = propertyExpressions;
073    }
074
075    /**
076     * @see org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean#getPropertyExpression
077     */
078    public String getPropertyExpression(String propertyName) {
079        if (this.propertyExpressions.containsKey(propertyName)) {
080            return this.propertyExpressions.get(propertyName);
081        }
082
083        return null;
084    }
085}