| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ViewTypeDictionaryIndex |
|
| 1.8;1.8 |
| 1 | /* | |
| 2 | * Copyright 2007 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 1.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/ecl1.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.kns.datadictionary.view; | |
| 17 | ||
| 18 | import java.util.HashMap; | |
| 19 | import java.util.Map; | |
| 20 | ||
| 21 | import org.kuali.rice.kns.datadictionary.DataDictionaryException; | |
| 22 | ||
| 23 | /** | |
| 24 | * Holds view index information for a view type, where the index keys are built | |
| 25 | * from the supported view type parameters | |
| 26 | * | |
| 27 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 28 | */ | |
| 29 | public class ViewTypeDictionaryIndex { | |
| 30 | private Map<String, String> viewIndex; | |
| 31 | ||
| 32 | 0 | public ViewTypeDictionaryIndex() { |
| 33 | 0 | viewIndex = new HashMap<String, String>(); |
| 34 | 0 | } |
| 35 | ||
| 36 | public Map<String, String> getViewIndex() { | |
| 37 | 0 | return this.viewIndex; |
| 38 | } | |
| 39 | ||
| 40 | public void setViewIndex(Map<String, String> viewIndex) { | |
| 41 | 0 | this.viewIndex = viewIndex; |
| 42 | 0 | } |
| 43 | ||
| 44 | public void put(String index, String beanName) { | |
| 45 | 0 | if (viewIndex.containsKey(index)) { |
| 46 | 0 | throw new DataDictionaryException("Two Views must not share the same type index: " + index); |
| 47 | } | |
| 48 | ||
| 49 | 0 | viewIndex.put(index, beanName); |
| 50 | 0 | } |
| 51 | ||
| 52 | public String get(String index) { | |
| 53 | 0 | if (viewIndex.containsKey(index)) { |
| 54 | 0 | return viewIndex.get(index); |
| 55 | } | |
| 56 | ||
| 57 | 0 | return null; |
| 58 | } | |
| 59 | ||
| 60 | } |