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.apache.struts.action.ActionMessages; |
29 | |
import org.kuali.rice.kew.quicklinks.service.QuickLinksService; |
30 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
31 | |
import org.kuali.rice.kew.web.KewKualiAction; |
32 | |
import org.kuali.rice.kew.web.KeyValue; |
33 | |
import org.kuali.rice.kew.web.session.UserSession; |
34 | |
import org.kuali.rice.kns.util.GlobalVariables; |
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | 0 | public class QuickLinksAction extends KewKualiAction { |
43 | |
|
44 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(QuickLinksAction.class); |
45 | |
|
46 | |
@Override |
47 | |
public ActionForward execute(ActionMapping mapping, ActionForm form, |
48 | |
HttpServletRequest request, HttpServletResponse response) |
49 | |
throws Exception { |
50 | 0 | initForm(request, form); |
51 | 0 | return super.execute(mapping, form, request, response); |
52 | |
} |
53 | |
|
54 | |
public void initForm(HttpServletRequest request, ActionForm form) throws Exception { |
55 | 0 | QuickLinksForm quickLinksForm = (QuickLinksForm)form; |
56 | 0 | String principalId = getUserSession(request).getPrincipalId(); |
57 | 0 | LOG.debug("getting Action List Stats"); |
58 | 0 | quickLinksForm.setActionListStats(getQuickLinksService().getActionListStats(principalId)); |
59 | 0 | LOG.debug("finished getting Action List Stats"); |
60 | |
|
61 | 0 | LOG.debug("getting Initiated Document Types"); |
62 | 0 | quickLinksForm.setInitiatedDocumentTypes(getQuickLinksService().getInitiatedDocumentTypesList(principalId)); |
63 | 0 | LOG.debug("finished getting Initiated Document Types"); |
64 | |
|
65 | 0 | LOG.debug("getting Named Searches"); |
66 | 0 | List namedSearches = new ArrayList(); |
67 | 0 | namedSearches.addAll(getQuickLinksService().getNamedSearches(principalId)); |
68 | 0 | quickLinksForm.setNamedSearches(namedSearches); |
69 | 0 | request.setAttribute("namedSearches",namedSearches); |
70 | 0 | LOG.debug("finished getting Named Searches"); |
71 | |
|
72 | 0 | LOG.debug("getting Recent Searches"); |
73 | 0 | quickLinksForm.setRecentSearches(getQuickLinksService().getRecentSearches(principalId)); |
74 | 0 | LOG.debug("finished getting Recent Searches"); |
75 | |
|
76 | 0 | LOG.debug("getting Watched Documents"); |
77 | 0 | quickLinksForm.setWatchedDocuments(getQuickLinksService().getWatchedDocuments(principalId)); |
78 | 0 | LOG.debug("finished getting Watched Documents"); |
79 | 0 | } |
80 | |
|
81 | |
|
82 | |
|
83 | |
private QuickLinksService getQuickLinksService() { |
84 | 0 | return ((QuickLinksService)KEWServiceLocator.getService(KEWServiceLocator.QUICK_LINKS_SERVICE)); |
85 | |
} |
86 | |
private static UserSession getUserSession(HttpServletRequest request) { |
87 | 0 | return UserSession.getAuthenticatedUser(); |
88 | |
} |
89 | |
|
90 | |
} |