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.view;
017
018import org.kuali.rice.kim.api.identity.Person;
019import org.kuali.rice.krad.uif.container.CollectionGroup;
020import org.kuali.rice.krad.uif.container.Group;
021import org.kuali.rice.krad.uif.field.ActionField;
022import org.kuali.rice.krad.uif.field.Field;
023import org.kuali.rice.krad.uif.field.InputField;
024import org.kuali.rice.krad.uif.widget.Widget;
025import org.kuali.rice.krad.web.form.UifFormBase;
026
027import java.util.Set;
028
029/**
030 * Configured for a <code>View</code> instance to provide conditional logic
031 * based on any variable (view configuration, system parameters, ...) that does
032 * not depend on the current user
033 *
034 * @author Kuali Rice Team (rice.collab@kuali.org)
035 */
036public interface ViewPresentationController {
037
038    public Set<String> getActionFlags(View view, UifFormBase model);
039
040    public Set<String> getEditModes(View view, UifFormBase model);
041
042    /**
043     * Determines if the the given view and data is allowed to be edited
044     *
045     * @param view - view instance to check whether editing is allowed
046     * @param model - object containing the view data
047     * @return boolean true if editing on the view is allowed, false otherwise
048     */
049    public boolean canEditView(View view, ViewModel model);
050
051    public boolean canEditField(View view, ViewModel model, Field field, String propertyName);
052
053    public boolean canViewField(View view, ViewModel model, Field field, String propertyName);
054
055    public boolean fieldIsRequired(View view, ViewModel model, Field field, String propertyName);
056
057    public boolean canEditGroup(View view, ViewModel model, Group group, String groupId);
058
059    public boolean canViewGroup(View view, ViewModel model, Group group, String groupId);
060
061    public boolean canEditWidget(View view, ViewModel model, Widget widget, String widgetId);
062
063    public boolean canViewWidget(View view, ViewModel model, Widget widget, String widgetId);
064
065    public boolean canPerformAction(View view, ViewModel model, ActionField actionField, String actionEvent,
066            String actionId);
067
068    public boolean canEditLine(View view, ViewModel model, CollectionGroup collectionGroup,
069            String collectionPropertyName, Object line);
070
071    public boolean canViewLine(View view, ViewModel model, CollectionGroup collectionGroup,
072            String collectionPropertyName, Object line);
073
074    public boolean canEditLineField(View view, ViewModel model, CollectionGroup collectionGroup,
075            String collectionPropertyName, Object line, Field field, String propertyName);
076
077    public boolean canViewLineField(View view, ViewModel model, CollectionGroup collectionGroup,
078            String collectionPropertyName, Object line, Field field, String propertyName);
079
080    public boolean canPerformLineAction(View view, ViewModel model, CollectionGroup collectionGroup,
081            String collectionPropertyName, Object line, ActionField actionField, String actionEvent, String actionId);
082
083}