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