001/**
002 * Copyright 2005-2018 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;
021
022import java.util.Map;
023
024/**
025 * Provides service methods for retrieving and updating <code>View</code> instances. The UIF
026 * interacts with this service from the client layer to pull information from the View dictionary
027 * and manage the View instance through its lifecycle
028 *
029 * @author Kuali Rice Team (rice.collab@kuali.org)
030 */
031public interface ViewService {
032
033    /**
034     * Returns the <code>View</code> entry identified by the given id
035     *
036     * <p>
037     * The id matches the id configured for the View through the dictionary. A new view instance
038     * is returned that is in the created state
039     * </p>
040     *
041     * @param viewId - unique id for view configured on its definition
042     * @return View instance associated with the id or Null if id is not found
043     */
044    public View getViewById(String viewId);
045
046    /**
047     * Retrieves the <code>View</code> instance that is of the given view type and matches the
048     * given parameters (that are applicable for that type). If more than one views exists for the
049     * type and parameters, the view type may choose a default or throw an exception
050     *
051     * <p>
052     * If a view if found for the type parameters, a new instance is returned that is in the
053     * created state
054     * </p>
055     *
056     * @param viewType - name that identifies the view type
057     * @param parameters - Map of parameter key/value pairs that are used to select the
058     * view, the parameters allowed depend on the view type
059     * @return View instance or Null if a matching view was not found
060     */
061    public View getViewByType(ViewType viewType, Map<String, String> parameters);
062
063    /**
064     * Retrieves the view id for the view associated with the given view type and view type parameters
065     *
066     * @param viewType name that identifies the view type
067     * @param parameters Map of parameter key/value pairs that are used to select the
068     * view, the parameters allowed depend on the view type
069     * @return id for the view or null if a matching view was not found
070     */
071    public String getViewIdForViewType(ViewType viewType, Map<String, String> parameters);
072
073    // TODO: remove once can get beans by type
074    public ViewTypeService getViewTypeService(UifConstants.ViewType viewType);
075
076}