Coverage Report - org.kuali.rice.krad.web.spring.UifAnnotationMethodHandleAdapter
 
Classes in this File Line Coverage Branch Coverage Complexity
UifAnnotationMethodHandleAdapter
0%
0/10
0%
0/6
2.333
 
 1  
 /*
 2  
  * Copyright 2007 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.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/ecl1.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.spring;
 17  
 
 18  
 import javax.servlet.http.HttpServletRequest;
 19  
 
 20  
 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
 21  
 import org.kuali.rice.krad.uif.service.ViewService;
 22  
 import org.kuali.rice.krad.web.spring.form.UifFormBase;
 23  
 import org.springframework.web.bind.ServletRequestDataBinder;
 24  
 import org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter;
 25  
 
 26  
 /**
 27  
  * This class is overloaded in order to hook in the UIF Binder classes. 
 28  
  * 
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 30  
  *
 31  
  */
 32  0
 public class UifAnnotationMethodHandleAdapter extends AnnotationMethodHandlerAdapter {
 33  
     
 34  
     protected ViewService viewService;
 35  
 
 36  
     @Override
 37  
     protected ServletRequestDataBinder createBinder(HttpServletRequest request, Object target, String objectName) throws Exception {
 38  0
         if (target != null) {
 39  
             // only override for UifFormBase models so that non KRAD spring MVC
 40  
             // can be used in same dispatcher servlet.
 41  0
             if (target instanceof UifFormBase) {
 42  
                 
 43  0
                 return new UifServletRequestDataBinder(target, objectName);
 44  
             }
 45  
         }
 46  0
         return super.createBinder(request, target, objectName);
 47  
     }
 48  
 
 49  
     public ViewService getViewService() {
 50  0
         if(viewService == null) {
 51  0
             viewService = KRADServiceLocatorWeb.getViewService();
 52  
         }
 53  0
         return this.viewService;
 54  
     }
 55  
 
 56  
     public void setViewService(ViewService viewService) {
 57  0
         this.viewService = viewService;
 58  0
     }
 59  
 
 60  
 }