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; 017 018import org.kuali.rice.krad.datadictionary.DataDictionaryException; 019 020import java.util.HashMap; 021import java.util.Map; 022 023/** 024 * Holds view index information for a view type, where the index keys are built 025 * from the supported view type parameters 026 * 027 * @author Kuali Rice Team (rice.collab@kuali.org) 028 */ 029public class ViewTypeDictionaryIndex { 030 private Map<String, String> viewIndex; 031 032 public ViewTypeDictionaryIndex() { 033 viewIndex = new HashMap<String, String>(); 034 } 035 036 public Map<String, String> getViewIndex() { 037 return this.viewIndex; 038 } 039 040 public void setViewIndex(Map<String, String> viewIndex) { 041 this.viewIndex = viewIndex; 042 } 043 044 public void put(String index, String beanName) { 045 if (viewIndex.containsKey(index)) { 046 throw new DataDictionaryException("Two Views must not share the same type index: " + index); 047 } 048 049 viewIndex.put(index, beanName); 050 } 051 052 public String get(String index) { 053 if (viewIndex.containsKey(index)) { 054 return viewIndex.get(index); 055 } 056 057 return null; 058 } 059 060}