View Javadoc

1   /**
2    * Copyright 2005-2014 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.uif.view;
17  
18  import org.kuali.rice.krad.uif.container.CollectionGroup;
19  import org.kuali.rice.krad.uif.container.Group;
20  import org.kuali.rice.krad.uif.element.Action;
21  import org.kuali.rice.krad.uif.field.Field;
22  import org.kuali.rice.krad.uif.widget.Widget;
23  import org.kuali.rice.krad.web.form.UifFormBase;
24  
25  import java.util.Set;
26  
27  /**
28   * Configured for a <code>View</code> instance to provide conditional authorization logic
29   * based on any variable (view configuration, system parameters, ...) that does
30   * not depend on the current user
31   *
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  public interface ViewPresentationController {
35  
36      public Set<String> getActionFlags(View view, UifFormBase model);
37  
38      public Set<String> getEditModes(View view, UifFormBase model);
39  
40      /**
41       * Determines if the the given view and data is allowed to be edited
42       *
43       * @param view - view instance to check whether editing is allowed
44       * @param model - object containing the view data
45       * @return boolean true if editing on the view is allowed, false otherwise
46       */
47      public boolean canEditView(View view, ViewModel model);
48  
49      /**
50       * Determines if the given field within the view is allowed to be edited
51       *
52       * @param view - view instance the field belongs to
53       * @param model - object containing the view data
54       * @param field - field instance to determine edit authorization for
55       * @param propertyName - name of the property that field corresponds with (if field is data binding)
56       * @return boolean true if editing on the field is allowed, false otherwise
57       */
58      public boolean canEditField(View view, ViewModel model, Field field, String propertyName);
59  
60      /**
61       * Determines if the given field within the view is allowed to be viewed
62       *
63       * @param view - view instance the field belongs to
64       * @param model - object containing the view data
65       * @param field - field instance to determine view authorization for
66       * @param propertyName - name of the property that field corresponds with (if field is data binding)
67       * @return boolean true if viewing of the field is allowed, false otherwise
68       */
69      public boolean canViewField(View view, ViewModel model, Field field, String propertyName);
70  
71      /**
72       * Determines if a value is required to be present for the given field (used to indicate in the client the
73       * field must be completed)
74       *
75       * @param view - view instance the field belongs to
76       * @param model - object containing the view data
77       * @param field - field instance to determine required state for
78       * @param propertyName - name of the property that field corresponds with (if field is data binding)
79       * @return boolean true if field is required, false otherwise
80       */
81      public boolean fieldIsRequired(View view, ViewModel model, Field field, String propertyName);
82  
83      public boolean canEditGroup(View view, ViewModel model, Group group, String groupId);
84  
85      public boolean canViewGroup(View view, ViewModel model, Group group, String groupId);
86  
87      public boolean canEditWidget(View view, ViewModel model, Widget widget, String widgetId);
88  
89      public boolean canViewWidget(View view, ViewModel model, Widget widget, String widgetId);
90  
91      public boolean canPerformAction(View view, ViewModel model, Action action, String actionEvent,
92              String actionId);
93  
94      public boolean canEditLine(View view, ViewModel model, CollectionGroup collectionGroup,
95              String collectionPropertyName, Object line);
96  
97      public boolean canViewLine(View view, ViewModel model, CollectionGroup collectionGroup,
98              String collectionPropertyName, Object line);
99  
100     public boolean canEditLineField(View view, ViewModel model, CollectionGroup collectionGroup,
101             String collectionPropertyName, Object line, Field field, String propertyName);
102 
103     public boolean canViewLineField(View view, ViewModel model, CollectionGroup collectionGroup,
104             String collectionPropertyName, Object line, Field field, String propertyName);
105 
106     public boolean canPerformLineAction(View view, ViewModel model, CollectionGroup collectionGroup,
107             String collectionPropertyName, Object line, Action action, String actionEvent, String actionId);
108 
109 }