1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.quicklinks.web; |
18 | |
|
19 | |
import java.util.ArrayList; |
20 | |
import java.util.List; |
21 | |
|
22 | |
import javax.servlet.http.HttpServletRequest; |
23 | |
import javax.servlet.http.HttpServletResponse; |
24 | |
|
25 | |
import org.apache.struts.action.ActionForm; |
26 | |
import org.apache.struts.action.ActionForward; |
27 | |
import org.apache.struts.action.ActionMapping; |
28 | |
import org.kuali.rice.kew.quicklinks.service.QuickLinksService; |
29 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
30 | |
import org.kuali.rice.kew.web.KewKualiAction; |
31 | |
import org.kuali.rice.krad.UserSession; |
32 | |
import org.kuali.rice.krad.util.GlobalVariables; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | 0 | public class QuickLinksAction extends KewKualiAction { |
41 | |
|
42 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(QuickLinksAction.class); |
43 | |
|
44 | |
@Override |
45 | |
public ActionForward execute(ActionMapping mapping, ActionForm form, |
46 | |
HttpServletRequest request, HttpServletResponse response) |
47 | |
throws Exception { |
48 | 0 | initForm(request, form); |
49 | 0 | return super.execute(mapping, form, request, response); |
50 | |
} |
51 | |
|
52 | |
public void initForm(HttpServletRequest request, ActionForm form) throws Exception { |
53 | 0 | QuickLinksForm quickLinksForm = (QuickLinksForm)form; |
54 | 0 | String principalId = getUserSession().getPrincipalId(); |
55 | 0 | LOG.debug("getting Action List Stats"); |
56 | 0 | quickLinksForm.setActionListStats(getQuickLinksService().getActionListStats(principalId)); |
57 | 0 | LOG.debug("finished getting Action List Stats"); |
58 | |
|
59 | 0 | LOG.debug("getting Initiated Document Types"); |
60 | 0 | quickLinksForm.setInitiatedDocumentTypes(getQuickLinksService().getInitiatedDocumentTypesList(principalId)); |
61 | 0 | LOG.debug("finished getting Initiated Document Types"); |
62 | |
|
63 | 0 | LOG.debug("getting Named Searches"); |
64 | 0 | List namedSearches = new ArrayList(); |
65 | 0 | namedSearches.addAll(getQuickLinksService().getNamedSearches(principalId)); |
66 | 0 | quickLinksForm.setNamedSearches(namedSearches); |
67 | 0 | request.setAttribute("namedSearches",namedSearches); |
68 | 0 | LOG.debug("finished getting Named Searches"); |
69 | |
|
70 | 0 | LOG.debug("getting Recent Searches"); |
71 | 0 | quickLinksForm.setRecentSearches(getQuickLinksService().getRecentSearches(principalId)); |
72 | 0 | LOG.debug("finished getting Recent Searches"); |
73 | |
|
74 | 0 | LOG.debug("getting Watched Documents"); |
75 | 0 | quickLinksForm.setWatchedDocuments(getQuickLinksService().getWatchedDocuments(principalId)); |
76 | 0 | LOG.debug("finished getting Watched Documents"); |
77 | 0 | } |
78 | |
|
79 | |
|
80 | |
|
81 | |
private QuickLinksService getQuickLinksService() { |
82 | 0 | return ((QuickLinksService)KEWServiceLocator.getService(KEWServiceLocator.QUICK_LINKS_SERVICE)); |
83 | |
} |
84 | |
private static UserSession getUserSession() { |
85 | 0 | return GlobalVariables.getUserSession(); |
86 | |
} |
87 | |
|
88 | |
} |