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