1 /** 2 * Copyright 2005-2012 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; 17 18 import org.kuali.rice.krad.uif.UifConstants; 19 import org.kuali.rice.krad.uif.view.View; 20 import org.kuali.rice.krad.uif.UifConstants.ViewType; 21 import org.springframework.beans.PropertyValues; 22 23 import java.util.List; 24 import java.util.Map; 25 import java.util.Set; 26 27 /** 28 * Maps one Document type to other document Type. 29 * 30 * This interface can be used to implement KNS to workflow document type 31 * mapping relationships other than one-to-one. 32 * 33 * @author mpk35 34 * 35 */ 36 public interface DataDictionaryMapper { 37 /** 38 * This method gets the business object entry for a concrete class 39 * 40 * @param className 41 * @return 42 */ 43 @Deprecated 44 public BusinessObjectEntry getBusinessObjectEntryForConcreteClass(DataDictionaryIndex index, String className); 45 46 /** 47 * This method gets the DataOjectEntry (or subclass) for a concrete class 48 * 49 * @param className 50 * @return the DataObjectEntry for the class or null if not found 51 */ 52 public DataObjectEntry getDataObjectEntryForConcreteClass(DataDictionaryIndex index, String className); 53 54 55 /** 56 * @return List of businessObject classnames 57 */ 58 @Deprecated 59 public List<String> getBusinessObjectClassNames(DataDictionaryIndex index); 60 61 /** 62 * @param className 63 * @return BusinessObjectEntry for the named class, or null if none exists 64 */ 65 @Deprecated 66 public BusinessObjectEntry getBusinessObjectEntry(DataDictionaryIndex index, String className ); 67 68 /** 69 * @param className 70 * @return DataObjectEntry for the named class, or null if none exists 71 */ 72 public DataObjectEntry getDataObjectEntry(DataDictionaryIndex index, String className ); 73 74 /** 75 * @return Map of (classname, BusinessObjectEntry) pairs 76 */ 77 @Deprecated 78 public Map<String, BusinessObjectEntry> getBusinessObjectEntries(DataDictionaryIndex index); 79 80 /** 81 * @param className 82 * @return DataDictionaryEntryBase for the named class, or null if none 83 * exists 84 */ 85 public DataDictionaryEntry getDictionaryObjectEntry(DataDictionaryIndex index, String className); 86 87 /** 88 * Returns the KNS document entry for the given lookup key. The documentTypeDDKey is interpreted 89 * successively in the following ways until a mapping is found (or none if found): 90 * <ol> 91 * <li>KEW/workflow document type</li> 92 * <li>business object class name</li> 93 * <li>maintainable class name</li> 94 * </ol> 95 * This mapping is compiled when DataDictionary files are parsed on startup (or demand). Currently this 96 * means the mapping is static, and one-to-one (one KNS document maps directly to one and only 97 * one key). 98 * 99 * @param documentTypeDDKey the KEW/workflow document type name 100 * @return the KNS DocumentEntry if it exists 101 */ 102 public DocumentEntry getDocumentEntry(DataDictionaryIndex index, String documentTypeDDKey); 103 104 /** 105 * Note: only MaintenanceDocuments are indexed by businessObject Class 106 * 107 * This is a special case that is referenced in one location. Do we need 108 * another map for this stuff?? 109 * 110 * @param businessObjectClass 111 * @return DocumentEntry associated with the given Class, or null if there 112 * is none 113 */ 114 public MaintenanceDocumentEntry getMaintenanceDocumentEntryForBusinessObjectClass(DataDictionaryIndex index, Class<?> businessObjectClass); 115 116 public Map<String, DocumentEntry> getDocumentEntries(DataDictionaryIndex index); 117 118 public Set<InactivationBlockingMetadata> getAllInactivationBlockingMetadatas(DataDictionaryIndex index, Class<?> blockedClass); 119 120 /** 121 * Returns mapped document type based on the given document type. 122 * 123 * @param documentType 124 * @return new document type or null if given documentType was not found. 125 */ 126 public String getDocumentTypeName(DataDictionaryIndex index, String documentTypeName); 127 128 /** 129 * Returns mapped document type class based on the given document type. 130 * 131 * @param documentType 132 * @return the class of the mapped document type or null if given documentType was not found. 133 */ 134 //public Class getDocumentTypeClass(String documentTypeName); 135 136 /** 137 * Returns the View entry identified by the given id 138 * 139 * @param index - the view dictionary index 140 * @param viewId - unique id for view 141 * @return View instance associated with the id 142 */ 143 public View getViewById(UifDictionaryIndex index, String viewId); 144 145 /** 146 * Called to retrieve a <code>View</code> instance that is of the given type 147 * based on the index key 148 * 149 * @param index - the view dictionary index 150 * @param viewTypeName 151 * - type name for the view 152 * @param indexKey 153 * - Map of index key parameters, these are the parameters the 154 * indexer used to index the view initially and needs to identify 155 * an unique view instance 156 * @return View instance that matches the given index 157 */ 158 public View getViewByTypeIndex(UifDictionaryIndex index, ViewType viewTypeName, Map<String, String> indexKey); 159 160 /** 161 * Indicates whether a <code>View</code> exists for the given view type and index information 162 * 163 * @param index - the view dictionary index 164 * @param viewTypeName - type name for the view 165 * @param indexKey - Map of index key parameters, these are the parameters the 166 * indexer used to index the view initially and needs to identify 167 * an unique view instance 168 * @return boolean true if view exists, false if not 169 */ 170 public boolean viewByTypeExist(UifDictionaryIndex index, ViewType viewTypeName, Map<String, String> indexKey); 171 172 /** 173 * Gets all <code>View</code> prototypes configured for the given view type 174 * name 175 * 176 * @param index - the view dictionary index 177 * @param viewTypeName 178 * - view type name to retrieve 179 * @return List<View> view prototypes with the given type name, or empty 180 * list 181 */ 182 public List<View> getViewsForType(UifDictionaryIndex index, UifConstants.ViewType viewTypeName); 183 184 /** 185 * Retrieves the configured property values for the view bean definition associated with the given id 186 * 187 * <p> 188 * Since constructing the View object can be expensive, when metadata only is needed this method can be used 189 * to retrieve the configured property values. Note this looks at the merged bean definition 190 * </p> 191 * 192 * @param index - the view dictionary index 193 * @param viewId - id for the view to retrieve 194 * @return PropertyValues configured on the view bean definition, or null if view is not found 195 */ 196 public PropertyValues getViewPropertiesById(UifDictionaryIndex index, String viewId); 197 198 /** 199 * Retrieves the configured property values for the view bean definition associated with the given type and 200 * index 201 * 202 * <p> 203 * Since constructing the View object can be expensive, when metadata only is needed this method can be used 204 * to retrieve the configured property values. Note this looks at the merged bean definition 205 * </p> 206 * 207 * @param index - the view dictionary index 208 * @param viewTypeName - type name for the view 209 * @param indexKey - Map of index key parameters, these are the parameters the indexer used to index 210 * the view initially and needs to identify an unique view instance 211 * @return PropertyValues configured on the view bean definition, or null if view is not found 212 */ 213 public PropertyValues getViewPropertiesByType(UifDictionaryIndex index, UifConstants.ViewType viewTypeName, 214 Map<String, String> indexKey); 215 216 }