| 1 | |
package org.kuali.student.enrollment.class2.acal.keyvalue; |
| 2 | |
|
| 3 | |
import java.io.Serializable; |
| 4 | |
import java.util.ArrayList; |
| 5 | |
import java.util.List; |
| 6 | |
|
| 7 | |
import javax.xml.namespace.QName; |
| 8 | |
|
| 9 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
| 10 | |
import org.kuali.rice.core.api.util.ConcreteKeyValue; |
| 11 | |
import org.kuali.rice.krad.keyvalues.KeyValuesBase; |
| 12 | |
|
| 13 | |
import org.kuali.student.enrollment.acal.service.AcademicCalendarService; |
| 14 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
| 15 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
| 16 | |
import org.kuali.student.r2.core.type.dto.TypeInfo; |
| 17 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
| 18 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
| 19 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
| 20 | |
|
| 21 | 0 | public class TermInfoTypeKeyValues extends KeyValuesBase implements Serializable{ |
| 22 | |
public static final String FALL_TERM_TYPE_KEY = "kuali.atp.type.Fall"; |
| 23 | |
public static final String WINTER_TERM_TYPE_KEY = "kuali.atp.type.Winter"; |
| 24 | |
public static final String SPRING_TERM_TYPE_KEY = "kuali.atp.type.Spring"; |
| 25 | |
public static final String SUMMER_TERM_TYPE_KEY = "kuali.atp.type.Summer"; |
| 26 | |
|
| 27 | |
private static final long serialVersionUID = 1L; |
| 28 | |
|
| 29 | |
private transient AcademicCalendarService academicCalendarService; |
| 30 | |
|
| 31 | |
public List getKeyValues() { |
| 32 | 0 | List <ConcreteKeyValue> keyValues = new ArrayList<ConcreteKeyValue>(); |
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | |
|
| 57 | |
|
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
|
| 62 | |
|
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
try { |
| 69 | 0 | List<TypeInfo> typeInfoList = getAcademicCalendarService().getTermTypes(new ContextInfo()); |
| 70 | 0 | for (TypeInfo typeInfo : typeInfoList){ |
| 71 | 0 | String typeKey = typeInfo.getKey(); |
| 72 | 0 | if (typeKey.equalsIgnoreCase(FALL_TERM_TYPE_KEY)){ |
| 73 | 0 | keyValues.add(new ConcreteKeyValue(typeKey, typeInfo.getName())); |
| 74 | |
} |
| 75 | 0 | else if(typeKey.equalsIgnoreCase(WINTER_TERM_TYPE_KEY)){ |
| 76 | 0 | keyValues.add(new ConcreteKeyValue(typeKey, typeInfo.getName())); |
| 77 | |
} |
| 78 | 0 | else if (typeKey.equalsIgnoreCase(SPRING_TERM_TYPE_KEY)){ |
| 79 | 0 | keyValues.add(new ConcreteKeyValue(typeKey, typeInfo.getName())); |
| 80 | |
} |
| 81 | 0 | else if (typeKey.equalsIgnoreCase(SUMMER_TERM_TYPE_KEY)){ |
| 82 | 0 | keyValues.add(new ConcreteKeyValue(typeKey, typeInfo.getName())); |
| 83 | |
} |
| 84 | 0 | } |
| 85 | |
|
| 86 | 0 | }catch (InvalidParameterException ipe){ |
| 87 | |
|
| 88 | 0 | }catch (MissingParameterException mpe){ |
| 89 | |
|
| 90 | 0 | }catch (OperationFailedException ofe){ |
| 91 | |
|
| 92 | 0 | }catch (PermissionDeniedException pde){ |
| 93 | 0 | } |
| 94 | 0 | return keyValues; |
| 95 | |
} |
| 96 | |
|
| 97 | |
protected AcademicCalendarService getAcademicCalendarService() { |
| 98 | 0 | if(academicCalendarService == null) { |
| 99 | 0 | academicCalendarService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/acal","AcademicCalendarService")); |
| 100 | |
} |
| 101 | |
|
| 102 | 0 | return academicCalendarService; |
| 103 | |
} |
| 104 | |
} |