View Javadoc

1   /**
2    * Copyright 2005-2013 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      * Called to retrieve a <code>View</code> instance that is of the given type
148      * based on the index key
149      *
150      * @param index - the view dictionary index
151      * @param viewTypeName - type name for the view
152      * @param indexKey - Map of index key parameters, these are the parameters the
153      * indexer used to index the view initially and needs to identify
154      * an unique view instance
155      * @return View instance that matches the given index
156      */
157     public View getViewByTypeIndex(UifDictionaryIndex index, ViewType viewTypeName, Map<String, String> indexKey);
158 
159     /**
160      * Indicates whether a <code>View</code> exists for the given view type and index information
161      *
162      * @param index - the view dictionary index
163      * @param viewTypeName - type name for the view
164      * @param indexKey - Map of index key parameters, these are the parameters the
165      * indexer used to index the view initially and needs to identify
166      * an unique view instance
167      * @return boolean true if view exists, false if not
168      */
169     public boolean viewByTypeExist(UifDictionaryIndex index, ViewType viewTypeName, Map<String, String> indexKey);
170 
171     /**
172      * Gets all <code>View</code> prototypes configured for the given view type
173      * name
174      *
175      * @param index - the view dictionary index
176      * @param viewTypeName - view type name to retrieve
177      * @return List<View> view prototypes with the given type name, or empty
178      *         list
179      */
180     public List<View> getViewsForType(UifDictionaryIndex index, UifConstants.ViewType viewTypeName);
181 
182     /**
183      * Retrieves the configured property values for the view bean definition associated with the given id
184      *
185      * <p>
186      * Since constructing the View object can be expensive, when metadata only is needed this method can be used
187      * to retrieve the configured property values. Note this looks at the merged bean definition
188      * </p>
189      *
190      * @param index - the view dictionary index
191      * @param viewId - id for the view to retrieve
192      * @return PropertyValues configured on the view bean definition, or null if view is not found
193      */
194     public PropertyValues getViewPropertiesById(UifDictionaryIndex index, String viewId);
195 
196     /**
197      * Retrieves the configured property values for the view bean definition associated with the given type and
198      * index
199      *
200      * <p>
201      * Since constructing the View object can be expensive, when metadata only is needed this method can be used
202      * to retrieve the configured property values. Note this looks at the merged bean definition
203      * </p>
204      *
205      * @param index - the view dictionary index
206      * @param viewTypeName - type name for the view
207      * @param indexKey - Map of index key parameters, these are the parameters the indexer used to index
208      * the view initially and needs to identify an unique view instance
209      * @return PropertyValues configured on the view bean definition, or null if view is not found
210      */
211     public PropertyValues getViewPropertiesByType(UifDictionaryIndex index, UifConstants.ViewType viewTypeName,
212             Map<String, String> indexKey);
213 
214 }