Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ViewService |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2007 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 1.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/ecl1.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.service; | |
17 | ||
18 | import org.kuali.rice.krad.uif.container.View; | |
19 | ||
20 | import java.util.Map; | |
21 | ||
22 | /** | |
23 | * Provides service methods for retrieving and updating <code>View</code> | |
24 | * instances. The UIF interacts with this service from the client layer to pull | |
25 | * information from the View dictionary and manage the View instance through its | |
26 | * lifecycle | |
27 | * | |
28 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
29 | */ | |
30 | public interface ViewService { | |
31 | ||
32 | /** | |
33 | * Returns the <code>View</code> entry identified by the given id | |
34 | * | |
35 | * <p> | |
36 | * The id matches the id configured for the View through the dictionary. The | |
37 | * view is initialized before being returned | |
38 | * </p> | |
39 | * | |
40 | * @param viewId | |
41 | * - unique id for view configured on its definition | |
42 | * @return View instance associated with the id or Null if id is not found | |
43 | */ | |
44 | public View getViewById(String viewId); | |
45 | ||
46 | /** | |
47 | * Returns the <code>View</code> entry identified by the given id | |
48 | * | |
49 | * <p> | |
50 | * The id matches the id configured for the View through the dictionary. The | |
51 | * view is initialized before being returned | |
52 | * </p> | |
53 | * <p> | |
54 | * Any configuration sent through the options Map is used to initialize the | |
55 | * View. This map contains present options the view is aware of and will | |
56 | * typically come from request parameters. e.g. For maintenance Views there | |
57 | * is the maintenance type option (new, edit, copy) | |
58 | * </p> | |
59 | * | |
60 | * @param viewId | |
61 | * - unique id for view configured on its definition | |
62 | * @param parameters | |
63 | * - Map of key values pairs that provide configuration for the | |
64 | * <code>View</code>, this is generally comes from the request | |
65 | * and can be the request parameter Map itself. Any parameters | |
66 | * not valid for the View will be filtered out | |
67 | * @return View instance associated with the id or Null if id is not found | |
68 | */ | |
69 | public View getView(String viewId, Map<String, String> parameters); | |
70 | ||
71 | /** | |
72 | * Retrieves the <code>View</code> instance that is of the given view type | |
73 | * and matches the given parameters (that are applicable for that type). If | |
74 | * more than one views exists for the type and parameters, the view type may | |
75 | * choose a default or throw an exception | |
76 | * | |
77 | * @param viewType | |
78 | * - name that identifies the view type | |
79 | * @param parameters | |
80 | * - Map of parameter key/value pairs that are used to select the | |
81 | * view, the parameters allowed depend on the view type | |
82 | * @return View instance or Null if a matching view was not found | |
83 | */ | |
84 | public View getViewByType(String viewType, Map<String, String> parameters); | |
85 | ||
86 | /** | |
87 | * Applies updates to the view based on the model data. Should be called to | |
88 | * finalize the view before rendering | |
89 | * | |
90 | * <p> | |
91 | * Performs dynamic generation of fields (such as collection rows), | |
92 | * conditional logic, and state updating (conditional hidden, read-only, | |
93 | * required). | |
94 | * </p> | |
95 | * | |
96 | * @param view | |
97 | * - view instance to update | |
98 | * @param model | |
99 | * - Top level object containing the data (could be the form or a | |
100 | * top level business object, dto) | |
101 | */ | |
102 | public void buildView(View view, Object model); | |
103 | ||
104 | /** | |
105 | * Returns the <code>View</code> entry identified by the given id and runs | |
106 | * through the complete lifecycle. Used to rebuild the view on a post before | |
107 | * rendering or on a session timeout | |
108 | * | |
109 | * @param viewId | |
110 | * - unique id for view configured on its definition | |
111 | * @param model | |
112 | * - Form object containing the data for the view | |
113 | * @param viewRequestParameters | |
114 | * - Map of key values pairs that provide parameters for the | |
115 | * view. This comes from the initial request to set view | |
116 | * properties that have the <code>RequestParameter</code> | |
117 | * annotation | |
118 | * @return View instance associated with the id or Null if id is not found | |
119 | */ | |
120 | public View rebuildView(String viewId, Object model, Map<String, String> viewRequestParameters); | |
121 | ||
122 | // TODO: remove once can get beans by type | |
123 | public ViewTypeService getViewTypeService(String viewType); | |
124 | ||
125 | } |