Coverage Report - org.kuali.rice.krad.uif.service.impl.InquiryViewTypeServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
InquiryViewTypeServiceImpl
0%
0/15
0%
0/4
2
 
 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.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.container.InquiryView;
 25  
 import org.kuali.rice.krad.uif.container.View;
 26  
 import org.kuali.rice.krad.uif.service.ViewTypeService;
 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 String getViewTypeName() {
 39  0
                 return ViewType.INQUIRY;
 40  
         }
 41  
 
 42  
         /**
 43  
          * @see org.kuali.rice.krad.uif.service.ViewTypeService#getParametersFromView(org.kuali.rice.krad.uif.container.View)
 44  
          */
 45  
         public Map<String, String> getParametersFromView(View view) {
 46  0
                 Map<String, String> parameters = new HashMap<String, String>();
 47  
 
 48  0
                 InquiryView inquiryView = (InquiryView) view;
 49  
 
 50  0
                 parameters.put(UifParameters.VIEW_NAME, inquiryView.getViewName());
 51  0
                 parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME, inquiryView.getDataObjectClassName().getName());
 52  
 
 53  0
                 return parameters;
 54  
         }
 55  
 
 56  
         /**
 57  
          * @see org.kuali.rice.krad.uif.service.ViewTypeService#getParametersFromRequest(java.util.Map)
 58  
          */
 59  
         public Map<String, String> getParametersFromRequest(Map<String, String> requestParameters) {
 60  0
                 Map<String, String> parameters = new HashMap<String, String>();
 61  
 
 62  0
                 if (requestParameters.containsKey(UifParameters.VIEW_NAME)) {
 63  0
                         parameters.put(UifParameters.VIEW_NAME, requestParameters.get(UifParameters.VIEW_NAME));
 64  
                 }
 65  
                 else {
 66  0
                         parameters.put(UifParameters.VIEW_NAME, UifConstants.DEFAULT_VIEW_NAME);
 67  
                 }
 68  
 
 69  0
                 if (requestParameters.containsKey(UifParameters.DATA_OBJECT_CLASS_NAME)) {
 70  0
                         parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME,
 71  
                                         requestParameters.get(UifParameters.DATA_OBJECT_CLASS_NAME));
 72  
                 }
 73  
                 else {
 74  0
                         throw new RuntimeException("Parameter '" + UifParameters.DATA_OBJECT_CLASS_NAME
 75  
                                         + "' must be given to find views of type: " + getViewTypeName());
 76  
                 }
 77  
 
 78  0
                 return parameters;
 79  
         }
 80  
 
 81  
 }