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.uif.service;
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.Map;
024
025/**
026 * Provides methods handing <code>View</code> instance of certain types
027 * 
028 * <p>
029 * The type service is invoked to handle type parameters that can be used for
030 * additional indexing of views and retrieval.
031 * </p>
032 * 
033 * <p>
034 * As the view dictionary entries are indexed the associated view type will be
035 * retrieved and if there is an associated <code>ViewTypeService</code> it will
036 * be invoked to provide parameter information for further indexing. This is
037 * useful to index a view based on other properties, like a class name.
038 * </p>
039 * 
040 * @author Kuali Rice Team (rice.collab@kuali.org)
041 */
042public interface ViewTypeService {
043
044        /**
045         * Gives the view type name that is supported by the type service
046         * 
047         * <p>
048         * The name is used to associated a type (and thus a view type service) with
049         * a view instance through the view type name property. Thus must be unique
050         * among all view types implemented
051         * </p>
052         * 
053         * @return ViewType view type name
054         */
055        public ViewType getViewTypeName();
056
057        /**
058         * Pulls values for the supported parameters from the views configured property values. These
059     * name/value pairs are used to index the view for later retrieval
060         * 
061         * @param propertyValues - property values configured on the view bean definition
062         * @return Map<String, String> of parameters where map key is the parameter
063         *         name, and the map value is the parameter value
064         */
065        public Map<String, String> getParametersFromViewConfiguration(PropertyValues propertyValues);
066
067        /**
068         * Pulls entries from the given map that are supported parameters for the view type. In addition,
069     * defaults can be set or additional parameters set as needed. Used by the <code>ViewService</code> to retrieve a
070         * <code>View</code> instance based on the incoming request parameters
071         * 
072         * @param requestParameters
073         *            - Map of request parameters to pull view type parameters from
074         * @return Map<String, String> of parameters where map key is the parameter
075         *         name, and the map value is the parameter value
076         */
077        public Map<String, String> getParametersFromRequest(Map<String, String> requestParameters);
078
079}