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