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