| 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 | 0 | public class QuickLinksAction extends KewKualiAction { |
| 40 | |
|
| 41 | 0 | 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 | 0 | initForm(request, form); |
| 48 | 0 | return super.execute(mapping, form, request, response); |
| 49 | |
} |
| 50 | |
|
| 51 | |
public void initForm(HttpServletRequest request, ActionForm form) throws Exception { |
| 52 | 0 | QuickLinksForm quickLinksForm = (QuickLinksForm)form; |
| 53 | 0 | String principalId = getUserSession().getPrincipalId(); |
| 54 | 0 | LOG.debug("getting Action List Stats"); |
| 55 | 0 | quickLinksForm.setActionListStats(getQuickLinksService().getActionListStats(principalId)); |
| 56 | 0 | LOG.debug("finished getting Action List Stats"); |
| 57 | |
|
| 58 | 0 | LOG.debug("getting Initiated Document Types"); |
| 59 | 0 | quickLinksForm.setInitiatedDocumentTypes(getQuickLinksService().getInitiatedDocumentTypesList(principalId)); |
| 60 | 0 | LOG.debug("finished getting Initiated Document Types"); |
| 61 | |
|
| 62 | 0 | LOG.debug("getting Named Searches"); |
| 63 | 0 | List namedSearches = new ArrayList(); |
| 64 | 0 | namedSearches.addAll(getQuickLinksService().getNamedSearches(principalId)); |
| 65 | 0 | quickLinksForm.setNamedSearches(namedSearches); |
| 66 | 0 | request.setAttribute("namedSearches",namedSearches); |
| 67 | 0 | LOG.debug("finished getting Named Searches"); |
| 68 | |
|
| 69 | 0 | LOG.debug("getting Recent Searches"); |
| 70 | 0 | quickLinksForm.setRecentSearches(getQuickLinksService().getRecentSearches(principalId)); |
| 71 | 0 | LOG.debug("finished getting Recent Searches"); |
| 72 | |
|
| 73 | 0 | LOG.debug("getting Watched Documents"); |
| 74 | 0 | quickLinksForm.setWatchedDocuments(getQuickLinksService().getWatchedDocuments(principalId)); |
| 75 | 0 | LOG.debug("finished getting Watched Documents"); |
| 76 | 0 | } |
| 77 | |
|
| 78 | |
|
| 79 | |
|
| 80 | |
private QuickLinksService getQuickLinksService() { |
| 81 | 0 | return ((QuickLinksService)KEWServiceLocator.getService(KEWServiceLocator.QUICK_LINKS_SERVICE)); |
| 82 | |
} |
| 83 | |
private static UserSession getUserSession() { |
| 84 | 0 | return GlobalVariables.getUserSession(); |
| 85 | |
} |
| 86 | |
|
| 87 | |
} |