001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.datadictionary;
017
018import org.kuali.rice.krad.uif.UifConstants;
019import org.kuali.rice.krad.uif.view.View;
020import org.kuali.rice.krad.uif.UifConstants.ViewType;
021import org.springframework.beans.PropertyValues;
022
023import java.util.List;
024import java.util.Map;
025import java.util.Set;
026
027/**
028 * Maps one Document type to other document Type.
029 * 
030 * This interface can be used to implement KNS to workflow document type
031 * mapping relationships other than one-to-one.
032 * 
033 * @author mpk35
034 *
035 */
036public interface DataDictionaryMapper {
037        /**
038         * This method gets the business object entry for a concrete class
039         * 
040         * @param className
041         * @return
042         */
043    @Deprecated
044        public BusinessObjectEntry getBusinessObjectEntryForConcreteClass(DataDictionaryIndex index, String className);
045        
046        /**
047     * This method gets the DataOjectEntry (or subclass) for a concrete class
048     * 
049     * @param className
050     * @return the DataObjectEntry for the class or null if not found
051     */
052    public DataObjectEntry getDataObjectEntryForConcreteClass(DataDictionaryIndex index, String className);
053    
054    
055        /**
056         * @return List of businessObject classnames
057         */
058    @Deprecated
059        public List<String> getBusinessObjectClassNames(DataDictionaryIndex index);
060
061        /**
062         * @param className
063         * @return BusinessObjectEntry for the named class, or null if none exists
064         */
065        @Deprecated
066        public BusinessObjectEntry getBusinessObjectEntry(DataDictionaryIndex index, String className );
067
068        /**
069     * @param className
070     * @return DataObjectEntry for the named class, or null if none exists
071     */
072    public DataObjectEntry getDataObjectEntry(DataDictionaryIndex index, String className );
073
074        /**
075         * @return Map of (classname, BusinessObjectEntry) pairs
076         */
077    @Deprecated
078        public Map<String, BusinessObjectEntry> getBusinessObjectEntries(DataDictionaryIndex index);
079        
080        /**
081         * @param className
082         * @return DataDictionaryEntryBase for the named class, or null if none
083         *         exists
084         */
085        public DataDictionaryEntry getDictionaryObjectEntry(DataDictionaryIndex index, String className);
086        
087        /**
088         * Returns the KNS document entry for the given lookup key.  The documentTypeDDKey is interpreted
089         * successively in the following ways until a mapping is found (or none if found):
090         * <ol>
091         * <li>KEW/workflow document type</li>
092         * <li>business object class name</li>
093         * <li>maintainable class name</li>
094         * </ol>
095         * This mapping is compiled when DataDictionary files are parsed on startup (or demand).  Currently this
096         * means the mapping is static, and one-to-one (one KNS document maps directly to one and only
097         * one key).
098         * 
099         * @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}