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