Coverage Report - org.kuali.rice.krad.web.controller.ModuleLockedController
 
Classes in this File Line Coverage Branch Coverage Complexity
ModuleLockedController
0%
0/11
0%
0/2
2
 
 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.krad.web.controller;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.core.framework.parameter.ParameterService;
 20  
 import org.kuali.rice.core.framework.services.CoreFrameworkServiceLocator;
 21  
 import org.kuali.rice.krad.util.KRADConstants;
 22  
 import org.springframework.stereotype.Controller;
 23  
 import org.springframework.web.bind.annotation.RequestMapping;
 24  
 import org.springframework.web.bind.annotation.RequestParam;
 25  
 import org.springframework.web.servlet.ModelAndView;
 26  
 
 27  
 /**
 28  
  * This simple controller loads the module locked view when a user accesses a
 29  
  * module which has been locked for maintenance.
 30  
  * 
 31  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 32  
  */
 33  
 @Controller
 34  0
 public class ModuleLockedController {
 35  
 
 36  
     /**
 37  
      * Constant defined to match with method call in moduleLocked.jsp which is
 38  
      * set to a message that is displayed when the module is locked.
 39  
      */
 40  
     public static final String MODULE_LOCKED_MESSAGE = "moduleLockedMessage";
 41  
     public static final String MODULE_PARAMETER = "moduleNamespace";
 42  
     
 43  
     @RequestMapping(value = "/module-locked")
 44  
     public ModelAndView moduleLocked(@RequestParam(value = MODULE_PARAMETER, required = true) String moduleNamespaceCode) {
 45  0
         ModelAndView modelAndView = new ModelAndView("moduleLocked");
 46  0
         ParameterService parameterSerivce = CoreFrameworkServiceLocator.getParameterService();
 47  0
         String messageParamComponentCode = KRADConstants.DetailTypes.OLTP_LOCKOUT_DETAIL_TYPE;
 48  0
         String messageParamName = KRADConstants.SystemGroupParameterNames.OLTP_LOCKOUT_MESSAGE_PARM;
 49  0
         String lockoutMessage = parameterSerivce.getParameterValueAsString(moduleNamespaceCode, messageParamComponentCode, messageParamName);
 50  
         
 51  0
         if(StringUtils.isBlank(lockoutMessage)) {
 52  0
             String defaultMessageParamName = KRADConstants.SystemGroupParameterNames.OLTP_LOCKOUT_DEFAULT_MESSAGE;
 53  0
             lockoutMessage = parameterSerivce.getParameterValueAsString(KRADConstants.KRAD_NAMESPACE, messageParamComponentCode, defaultMessageParamName);
 54  
         }
 55  0
         modelAndView.addObject(MODULE_LOCKED_MESSAGE, lockoutMessage);
 56  0
         return modelAndView;
 57  
     }
 58  
 }