Coverage Report - org.kuali.student.enrollment.class2.appointment.keyvalue.SlotRuleForAppWindowKeyValuesFinder
 
Classes in this File Line Coverage Branch Coverage Complexity
SlotRuleForAppWindowKeyValuesFinder
0%
0/21
0%
0/6
2
 
 1  
 /**
 2  
  * Copyright 2012 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  *
 15  
  * Created by Adi Rajesh on 4/12/12
 16  
  */
 17  
 package org.kuali.student.enrollment.class2.appointment.keyvalue;
 18  
 
 19  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 20  
 import org.kuali.rice.core.api.util.ConcreteKeyValue;
 21  
 import org.kuali.rice.core.api.util.KeyValue;
 22  
 import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;
 23  
 import org.kuali.rice.krad.uif.view.ViewModel;
 24  
 import org.kuali.student.core.enumerationmanagement.dto.EnumeratedValueInfo;
 25  
 import org.kuali.student.core.enumerationmanagement.service.EnumerationManagementService;
 26  
 import org.kuali.student.mock.utilities.TestHelper;
 27  
 import org.kuali.student.r2.common.constants.CommonServiceConstants;
 28  
 import org.kuali.student.r2.common.dto.ContextInfo;
 29  
 
 30  
 import javax.xml.namespace.QName;
 31  
 import java.io.Serializable;
 32  
 import java.util.ArrayList;
 33  
 import java.util.List;
 34  
 
 35  
 /**
 36  
  * This class //TODO ...
 37  
  *
 38  
  * @author Kuali Student Team
 39  
  */
 40  0
 public class SlotRuleForAppWindowKeyValuesFinder extends UifKeyValuesFinderBase implements Serializable {
 41  
     private transient EnumerationManagementService enumerationService;
 42  
     private Object object;
 43  
     private String enumerationKey;
 44  
 
 45  
     public String getEnumerationKey() {
 46  0
         return enumerationKey;
 47  
     }
 48  
     public void setEnumerationKey(String enumerationKey){
 49  0
         this.enumerationKey = enumerationKey;
 50  0
     }
 51  
 
 52  
     @Override
 53  
 
 54  
     //this method returns the enumeration values as key value pairs to the UI for appoint rule type which is passed as enumerationKey to the
 55  
     // enumeration management service.
 56  
     public List<KeyValue> getKeyValues(ViewModel model) {
 57  
 
 58  0
         List<KeyValue> keyValues = new ArrayList<KeyValue>();
 59  
 
 60  
         //TODO:Build real context.
 61  0
         ContextInfo context = TestHelper.getContext1();
 62  
 
 63  
         try {
 64  0
             List<EnumeratedValueInfo> slotRuleTypeCodes = getEnumerationService().getEnumeratedValues(getEnumerationKey(),null,null,null);
 65  0
             if(slotRuleTypeCodes!=null)  {
 66  0
                 for (EnumeratedValueInfo slotRuleTypeCode : slotRuleTypeCodes) {
 67  0
                     ConcreteKeyValue keyValue = new ConcreteKeyValue();
 68  0
                     keyValue.setKey(slotRuleTypeCode.getValue());
 69  0
                     keyValue.setValue(slotRuleTypeCode.getAbbrevValue());
 70  0
                     keyValues.add(keyValue);
 71  0
                 }
 72  
             }
 73  0
         } catch (Exception e) {
 74  0
             e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
 75  0
         }
 76  
 
 77  0
         return keyValues;
 78  
     }
 79  
 
 80  
     //returns the enumerationmangement service
 81  
     public EnumerationManagementService getEnumerationService() {
 82  0
         if(enumerationService == null) {
 83  0
             enumerationService = GlobalResourceLoader.getService(new QName(CommonServiceConstants.REF_OBJECT_URI_GLOBAL_PREFIX+"enumerationmanagement", "EnumerationManagementService"));
 84  
         }
 85  0
         return this.enumerationService;
 86  
     }
 87  
 }