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