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