1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
package org.kuali.rice.kew.actionlist.web; |
15 | |
|
16 | |
import java.util.ArrayList; |
17 | |
import java.util.HashMap; |
18 | |
import java.util.List; |
19 | |
import java.util.Map; |
20 | |
import java.util.Properties; |
21 | |
|
22 | |
import javax.servlet.http.HttpServletRequest; |
23 | |
|
24 | |
import org.kuali.rice.core.config.ConfigContext; |
25 | |
import org.kuali.rice.kew.actionlist.ActionToTake; |
26 | |
import org.kuali.rice.kew.util.KEWConstants; |
27 | |
import org.kuali.rice.kew.util.Utilities; |
28 | |
import org.kuali.rice.kew.util.WebFriendlyRecipient; |
29 | |
import org.kuali.rice.kew.web.session.UserSession; |
30 | |
import org.kuali.rice.kim.bo.types.dto.AttributeSet; |
31 | |
import org.kuali.rice.kim.service.KIMServiceLocator; |
32 | |
import org.kuali.rice.kns.util.GlobalVariables; |
33 | |
import org.kuali.rice.kns.util.KNSConstants; |
34 | |
import org.kuali.rice.kns.util.UrlFactory; |
35 | |
import org.kuali.rice.kns.web.struts.form.KualiForm; |
36 | |
import org.kuali.rice.kns.web.ui.ExtraButton; |
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | 0 | public class ActionListForm extends KualiForm { |
45 | |
|
46 | |
private static final long serialVersionUID = -6246391732337228007L; |
47 | |
|
48 | |
private String delegator; |
49 | 0 | private String methodToCall = ""; |
50 | |
private String helpDeskActionListUserName; |
51 | |
private String docType; |
52 | |
private String filterLegend; |
53 | |
private String actionListType; |
54 | |
private Boolean customActionList; |
55 | |
private String defaultActionToTake; |
56 | 0 | private List<ActionToTake> actionsToTake = new ArrayList<ActionToTake>(); |
57 | 0 | private Map<?, ?> defaultActions = new HashMap<Object, Object>(); |
58 | |
private String delegationId; |
59 | |
private List<?> delegators; |
60 | |
private Boolean hasCustomActions; |
61 | |
private Boolean routeLogPopup; |
62 | |
private Boolean documentPopup; |
63 | |
private List<WebFriendlyRecipient> primaryDelegates; |
64 | |
private String primaryDelegateId; |
65 | |
|
66 | |
private Boolean hasDisplayParameters; |
67 | |
|
68 | |
|
69 | |
private Integer currentPage; |
70 | |
private String currentSort; |
71 | |
private String currentDir; |
72 | |
|
73 | |
|
74 | |
private Integer page; |
75 | |
private String sort; |
76 | |
private String dir; |
77 | |
|
78 | |
private int count; |
79 | 0 | private String cssFile = "kuali.css"; |
80 | 0 | private String logoAlign = "left"; |
81 | |
private String viewOutbox; |
82 | |
private String[] outboxItems; |
83 | |
private boolean outBoxEmpty; |
84 | |
private Boolean showOutbox; |
85 | 0 | private List<ExtraButton> headerButtons = new ArrayList<ExtraButton>(); |
86 | |
|
87 | |
public String getHelpDeskActionListUserName() { |
88 | 0 | return helpDeskActionListUserName; |
89 | |
} |
90 | |
|
91 | |
public void setHelpDeskActionListUserName(String helpDeskActionListUserName) { |
92 | 0 | this.helpDeskActionListUserName = helpDeskActionListUserName; |
93 | 0 | } |
94 | |
|
95 | |
public String getMethodToCall() { |
96 | 0 | return methodToCall; |
97 | |
} |
98 | |
|
99 | |
public void setMethodToCall(String methodToCall) { |
100 | 0 | this.methodToCall = methodToCall; |
101 | 0 | } |
102 | |
|
103 | |
public String getDelegator() { |
104 | 0 | return delegator; |
105 | |
} |
106 | |
|
107 | |
public void setDelegator(String delegator) { |
108 | 0 | this.delegator = delegator; |
109 | 0 | } |
110 | |
|
111 | |
public String getDocType() { |
112 | 0 | return docType; |
113 | |
} |
114 | |
|
115 | |
public void setDocType(String docType) { |
116 | 0 | this.docType = docType; |
117 | 0 | } |
118 | |
|
119 | |
public String getFilterLegend() { |
120 | 0 | return filterLegend; |
121 | |
} |
122 | |
|
123 | |
public void setFilterLegend(String filterLegend) { |
124 | 0 | this.filterLegend = filterLegend; |
125 | 0 | } |
126 | |
|
127 | |
public String getActionListType() { |
128 | 0 | if (actionListType == null) { |
129 | 0 | setActionListType("all"); |
130 | |
} |
131 | 0 | return actionListType; |
132 | |
} |
133 | |
|
134 | |
public void setActionListType(String actionListType) { |
135 | 0 | this.actionListType = actionListType; |
136 | 0 | } |
137 | |
|
138 | |
public Boolean getCustomActionList() { |
139 | 0 | return customActionList; |
140 | |
} |
141 | |
|
142 | |
public void setCustomActionList(Boolean customActionList) { |
143 | 0 | this.customActionList = customActionList; |
144 | 0 | } |
145 | |
|
146 | |
public String getDefaultActionToTake() { |
147 | 0 | return defaultActionToTake; |
148 | |
} |
149 | |
|
150 | |
public void setDefaultActionToTake(String defaultActionToTake) { |
151 | 0 | this.defaultActionToTake = defaultActionToTake; |
152 | 0 | } |
153 | |
|
154 | |
public List<ActionToTake> getActionsToTake() { |
155 | 0 | return actionsToTake; |
156 | |
} |
157 | |
|
158 | |
public void setActionsToTake(List<ActionToTake> actionsToTake) { |
159 | 0 | this.actionsToTake = actionsToTake; |
160 | 0 | } |
161 | |
|
162 | |
public ActionToTake getActions(int index) { |
163 | 0 | while (getActionsToTake().size() <= index) { |
164 | 0 | getActionsToTake().add(new ActionToTake()); |
165 | |
} |
166 | 0 | return getActionsToTake().get(index); |
167 | |
} |
168 | |
|
169 | |
public Map<?, ?> getDefaultActions() { |
170 | 0 | return defaultActions; |
171 | |
} |
172 | |
|
173 | |
public void setDefaultActions(Map<?, ?> defaultActions) { |
174 | 0 | this.defaultActions = defaultActions; |
175 | 0 | } |
176 | |
|
177 | |
public String getDelegationId() { |
178 | 0 | return delegationId; |
179 | |
} |
180 | |
|
181 | |
public void setDelegationId(String delegationId) { |
182 | 0 | this.delegationId = delegationId; |
183 | 0 | } |
184 | |
|
185 | |
public List<?> getDelegators() { |
186 | 0 | return delegators; |
187 | |
} |
188 | |
|
189 | |
public void setDelegators(List<?> delegators) { |
190 | 0 | this.delegators = delegators; |
191 | 0 | } |
192 | |
|
193 | |
public Boolean getHasCustomActions() { |
194 | 0 | return hasCustomActions; |
195 | |
} |
196 | |
|
197 | |
public void setHasCustomActions(Boolean hasCustomActions) { |
198 | 0 | this.hasCustomActions = hasCustomActions; |
199 | 0 | } |
200 | |
|
201 | |
public String getDir() { |
202 | 0 | return dir; |
203 | |
} |
204 | |
|
205 | |
public void setDir(String dir) { |
206 | 0 | this.dir = dir; |
207 | 0 | } |
208 | |
|
209 | |
public Integer getPage() { |
210 | 0 | return page; |
211 | |
} |
212 | |
|
213 | |
public void setPage(Integer page) { |
214 | 0 | this.page = page; |
215 | 0 | } |
216 | |
|
217 | |
public String getSort() { |
218 | 0 | return sort; |
219 | |
} |
220 | |
|
221 | |
public void setSort(String sort) { |
222 | 0 | this.sort = sort; |
223 | 0 | } |
224 | |
|
225 | |
public Integer getCurrentPage() { |
226 | 0 | return currentPage; |
227 | |
} |
228 | |
|
229 | |
public void setCurrentPage(Integer currentPage) { |
230 | 0 | this.currentPage = currentPage; |
231 | 0 | } |
232 | |
|
233 | |
public String getCurrentDir() { |
234 | 0 | return currentDir; |
235 | |
} |
236 | |
|
237 | |
public void setCurrentDir(String currentDir) { |
238 | 0 | this.currentDir = currentDir; |
239 | 0 | } |
240 | |
|
241 | |
public String getCurrentSort() { |
242 | 0 | return currentSort; |
243 | |
} |
244 | |
|
245 | |
public void setCurrentSort(String currentSort) { |
246 | 0 | this.currentSort = currentSort; |
247 | 0 | } |
248 | |
|
249 | |
public int getCount() { |
250 | 0 | return count; |
251 | |
} |
252 | |
|
253 | |
public void setCount(int count) { |
254 | 0 | this.count = count; |
255 | 0 | } |
256 | |
|
257 | |
public String getCssFile() { |
258 | 0 | return cssFile; |
259 | |
} |
260 | |
|
261 | |
public void setCssFile(String cssFile) { |
262 | 0 | this.cssFile = cssFile; |
263 | 0 | } |
264 | |
|
265 | |
public String getLogoAlign() { |
266 | 0 | return logoAlign; |
267 | |
} |
268 | |
|
269 | |
public void setLogoAlign(String logoAlign) { |
270 | 0 | this.logoAlign = logoAlign; |
271 | 0 | } |
272 | |
|
273 | |
public String getViewOutbox() { |
274 | 0 | return this.viewOutbox; |
275 | |
} |
276 | |
|
277 | |
public void setViewOutbox(String viewOutbox) { |
278 | 0 | this.viewOutbox = viewOutbox; |
279 | 0 | } |
280 | |
|
281 | |
public String[] getOutboxItems() { |
282 | 0 | return outboxItems; |
283 | |
} |
284 | |
|
285 | |
public void setOutboxItems(String[] outboxItems) { |
286 | 0 | this.outboxItems = outboxItems; |
287 | 0 | } |
288 | |
|
289 | |
public boolean isOutBoxEmpty() { |
290 | 0 | return this.outBoxEmpty; |
291 | |
} |
292 | |
|
293 | |
public void setOutBoxEmpty(boolean outBoxEmpty) { |
294 | 0 | this.outBoxEmpty = outBoxEmpty; |
295 | 0 | } |
296 | |
|
297 | |
public Boolean getShowOutbox() { |
298 | 0 | return this.showOutbox; |
299 | |
} |
300 | |
|
301 | |
public void setShowOutbox(Boolean showOutbox) { |
302 | 0 | this.showOutbox = showOutbox; |
303 | 0 | } |
304 | |
|
305 | |
public List<ExtraButton> getHeaderButtons() { |
306 | 0 | return this.headerButtons; |
307 | |
} |
308 | |
|
309 | |
public void setHeaderButtons(List<ExtraButton> headerButtons) { |
310 | 0 | this.headerButtons = headerButtons; |
311 | 0 | } |
312 | |
|
313 | |
public String getMenuBar(){ |
314 | 0 | String url = ""; |
315 | 0 | Properties parameters = new Properties(); |
316 | 0 | url = UrlFactory.parameterizeUrl(KNSConstants.MAINTENANCE_ACTION, parameters); |
317 | 0 | String krBaseUrl = ConfigContext.getCurrentContextConfig().getKRBaseURL(); |
318 | 0 | url = "<a href=\"" + url + "\"><img src=\""+krBaseUrl+"/images/tinybutton-preferences.gif\" alt=\"create new\" width=\"70\" height=\"15\"/></a>"; |
319 | 0 | return url; |
320 | |
} |
321 | |
|
322 | |
@Override |
323 | |
public void populate(HttpServletRequest request) { |
324 | 0 | UserSession userSession = UserSession.getAuthenticatedUser(); |
325 | 0 | setHeaderButtons(getHeaderButtons()); |
326 | |
|
327 | |
|
328 | 0 | request.setAttribute("UserSession", userSession); |
329 | |
|
330 | |
|
331 | 0 | request.setAttribute("preferences", userSession); |
332 | |
|
333 | 0 | String principalId = GlobalVariables.getUserSession().getPrincipalId(); |
334 | 0 | if (userSession.getHelpDeskActionListPrincipal() != null) { |
335 | 0 | setHelpDeskActionListUserName(userSession.getHelpDeskActionListPrincipal().getPrincipalName()); |
336 | |
} |
337 | 0 | boolean isHelpDeskAuthorized = KIMServiceLocator.getIdentityManagementService().isAuthorized(principalId, KEWConstants.KEW_NAMESPACE, KEWConstants.PermissionNames.VIEW_OTHER_ACTION_LIST, new AttributeSet(), new AttributeSet()); |
338 | 0 | if (isHelpDeskAuthorized) { |
339 | 0 | request.setAttribute("helpDeskActionList", "true"); |
340 | |
} |
341 | |
|
342 | |
|
343 | |
|
344 | |
|
345 | |
|
346 | |
|
347 | |
|
348 | |
|
349 | |
|
350 | |
|
351 | 0 | setRouteLogPopup(Utilities.getKNSParameterBooleanValue(KEWConstants.KEW_NAMESPACE, KNSConstants.DetailTypes.ACTION_LIST_DETAIL_TYPE, KEWConstants.ACTION_LIST_ROUTE_LOG_POPUP_IND)); |
352 | 0 | setDocumentPopup(Utilities.getKNSParameterBooleanValue(KEWConstants.KEW_NAMESPACE, KNSConstants.DetailTypes.ACTION_LIST_DETAIL_TYPE, KEWConstants.ACTION_LIST_DOCUMENT_POPUP_IND)); |
353 | 0 | request.setAttribute("noRefresh", Boolean.valueOf(ConfigContext.getCurrentContextConfig().getProperty(KEWConstants.ACTION_LIST_NO_REFRESH))); |
354 | 0 | super.populate(request); |
355 | 0 | } |
356 | |
|
357 | |
public Boolean getRouteLogPopup() { |
358 | 0 | return this.routeLogPopup; |
359 | |
} |
360 | |
|
361 | |
public Boolean getDocumentPopup() { |
362 | 0 | return this.documentPopup; |
363 | |
} |
364 | |
|
365 | |
public void setRouteLogPopup(Boolean routeLogPopup) { |
366 | 0 | this.routeLogPopup = routeLogPopup; |
367 | 0 | } |
368 | |
|
369 | |
public void setDocumentPopup(Boolean documentPopup) { |
370 | 0 | this.documentPopup = documentPopup; |
371 | 0 | } |
372 | |
|
373 | |
public Boolean getHasDisplayParameters() { |
374 | 0 | return this.hasDisplayParameters; |
375 | |
} |
376 | |
|
377 | |
public void setHasDisplayParameters(Boolean hasDisplayParameters) { |
378 | 0 | this.hasDisplayParameters = hasDisplayParameters; |
379 | 0 | } |
380 | |
|
381 | |
public List<WebFriendlyRecipient> getPrimaryDelegates() { |
382 | 0 | return this.primaryDelegates; |
383 | |
} |
384 | |
|
385 | |
public void setPrimaryDelegates(List<WebFriendlyRecipient> primaryDelegates) { |
386 | 0 | this.primaryDelegates = primaryDelegates; |
387 | 0 | } |
388 | |
|
389 | |
public String getPrimaryDelegateId() { |
390 | 0 | return this.primaryDelegateId; |
391 | |
} |
392 | |
|
393 | |
public void setPrimaryDelegateId(String primaryDelegateId) { |
394 | 0 | this.primaryDelegateId = primaryDelegateId; |
395 | 0 | } |
396 | |
|
397 | |
} |