Coverage Report - org.kuali.rice.krad.uif.service.impl.InquiryViewTypeServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
InquiryViewTypeServiceImpl
0%
0/16
0%
0/4
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.uif.service.impl;
 17  
 
 18  
 import java.util.HashMap;
 19  
 import java.util.Map;
 20  
 
 21  
 import org.kuali.rice.krad.uif.UifConstants;
 22  
 import org.kuali.rice.krad.uif.UifConstants.ViewType;
 23  
 import org.kuali.rice.krad.uif.UifParameters;
 24  
 import org.kuali.rice.krad.uif.util.ViewModelUtils;
 25  
 import org.kuali.rice.krad.uif.service.ViewTypeService;
 26  
 import org.springframework.beans.PropertyValues;
 27  
 
 28  
 /**
 29  
  * Type service implementation for Inquiry views
 30  
  * 
 31  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 32  
  */
 33  0
 public class InquiryViewTypeServiceImpl implements ViewTypeService {
 34  
 
 35  
         /**
 36  
          * @see org.kuali.rice.krad.uif.service.ViewTypeService#getViewTypeName()
 37  
          */
 38  
         public ViewType getViewTypeName() {
 39  0
                 return ViewType.INQUIRY;
 40  
         }
 41  
 
 42  
     /**
 43  
      * @see org.kuali.rice.krad.uif.service.ViewTypeService#getParametersFromViewConfiguration(org.springframework.beans.PropertyValues)
 44  
      */
 45  
     public Map<String, String> getParametersFromViewConfiguration(PropertyValues propertyValues) {
 46  0
         Map<String, String> parameters = new HashMap<String, String>();
 47  
 
 48  0
         String viewName = ViewModelUtils.getStringValFromPVs(propertyValues, UifParameters.VIEW_NAME);
 49  0
         String dataObjectClassName = ViewModelUtils.getStringValFromPVs(propertyValues,
 50  
                 UifParameters.DATA_OBJECT_CLASS_NAME);
 51  
 
 52  0
         parameters.put(UifParameters.VIEW_NAME, viewName);
 53  0
         parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME, dataObjectClassName);
 54  
 
 55  0
         return parameters;
 56  
     }
 57  
 
 58  
         /**
 59  
          * @see org.kuali.rice.krad.uif.service.ViewTypeService#getParametersFromRequest(java.util.Map)
 60  
          */
 61  
         public Map<String, String> getParametersFromRequest(Map<String, String> requestParameters) {
 62  0
                 Map<String, String> parameters = new HashMap<String, String>();
 63  
 
 64  0
                 if (requestParameters.containsKey(UifParameters.VIEW_NAME)) {
 65  0
                         parameters.put(UifParameters.VIEW_NAME, requestParameters.get(UifParameters.VIEW_NAME));
 66  
                 }
 67  
                 else {
 68  0
                         parameters.put(UifParameters.VIEW_NAME, UifConstants.DEFAULT_VIEW_NAME);
 69  
                 }
 70  
 
 71  0
                 if (requestParameters.containsKey(UifParameters.DATA_OBJECT_CLASS_NAME)) {
 72  0
                         parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME,
 73  
                                         requestParameters.get(UifParameters.DATA_OBJECT_CLASS_NAME));
 74  
                 }
 75  
                 else {
 76  0
                         throw new RuntimeException("Parameter '" + UifParameters.DATA_OBJECT_CLASS_NAME
 77  
                                         + "' must be given to find views of type: " + getViewTypeName());
 78  
                 }
 79  
 
 80  0
                 return parameters;
 81  
         }
 82  
 
 83  
 }