Coverage Report - org.kuali.rice.kew.quicklinks.web.QuickLinksAction
 
Classes in this File Line Coverage Branch Coverage Complexity
QuickLinksAction
0%
0/27
N/A
1
 
 1  
 /*
 2  
  * Copyright 2005-2008 The Kuali Foundation
 3  
  *
 4  
  *
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  *
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 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  
  * A Struts Action for interfacing with the Quick Links system
 39  
  *
 40  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 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  
 }