Coverage Report - org.kuali.student.enrollment.class2.acal.keyvalue.CredentialProgramTypeKeyValues
 
Classes in this File Line Coverage Branch Coverage Complexity
CredentialProgramTypeKeyValues
0%
0/19
0%
0/8
3
 
 1  
 package org.kuali.student.enrollment.class2.acal.keyvalue;
 2  
 
 3  
 import java.util.ArrayList;
 4  
 import java.util.Collections;
 5  
 import java.util.List;
 6  
 import java.util.Iterator;
 7  
 import java.io.Serializable;
 8  
 
 9  
 import javax.xml.namespace.QName;
 10  
 
 11  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 12  
 import org.kuali.rice.core.api.util.ConcreteKeyValue;
 13  
 
 14  
 import org.kuali.rice.core.api.util.KeyValue;
 15  
 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
 16  
 import org.kuali.student.lum.lu.service.LuServiceConstants;
 17  
 import org.kuali.student.lum.lu.service.LuService;
 18  
 import org.kuali.student.common.exceptions.OperationFailedException;
 19  
 import org.kuali.student.lum.lu.dto.LuTypeInfo;
 20  
 
 21  0
 public class CredentialProgramTypeKeyValues extends KeyValuesBase implements Serializable{
 22  
         public static final String CREDENTIAL_PROGRAM_TYPE_KEY_PREFIX = "kuali.lu.type.credential.";
 23  
         private static final long serialVersionUID = 1L;        
 24  
         
 25  
     private transient LuService luService;
 26  
 
 27  
     private static List<LuTypeInfo> luTypes;
 28  
 
 29  
     public List<KeyValue> getKeyValues() {
 30  0
         List<KeyValue> keyValues = new ArrayList<KeyValue>();
 31  
 
 32  
         try {
 33  
                 //pull out data from KSLU_LUTYPE
 34  0
                    List<LuTypeInfo> luTypeInfoList = getLuTypes();
 35  
                 
 36  0
             for(LuTypeInfo luTypeInfo : luTypeInfoList) {
 37  0
                 String luTypeInfoKey = luTypeInfo.getId();
 38  0
                 if (luTypeInfoKey.startsWith(CREDENTIAL_PROGRAM_TYPE_KEY_PREFIX)){
 39  0
                     String name = luTypeInfo.getName();
 40  0
                     keyValues.add(new ConcreteKeyValue(luTypeInfoKey,name));
 41  
                 }
 42  0
             }
 43  0
         }catch (OperationFailedException e) {
 44  0
             throw new RuntimeException(e);
 45  0
         }
 46  
        
 47  0
         return keyValues;
 48  
     }
 49  
     
 50  
     //Note: here I am using r1 LuService implementation!!!
 51  
     protected LuService getLuService() {
 52  0
         if(luService == null) {
 53  0
                 luService = (LuService)GlobalResourceLoader.getService(new QName(LuServiceConstants.LU_NAMESPACE,"LuService"));
 54  
         }
 55  0
         return this.luService;
 56  
     }
 57  
 
 58  
     public List<LuTypeInfo> getLuTypes() throws OperationFailedException {
 59  0
         if(luTypes == null) {
 60  0
             luTypes = Collections.unmodifiableList(getLuService().getLuTypes());
 61  
         }
 62  
 
 63  0
         return luTypes;
 64  
     }
 65  
 }