1 package org.kuali.student.enrollment.rules.credit.limit;
2
3 import java.util.List;
4 import org.kuali.rice.core.api.util.type.KualiDecimal;
5 import org.kuali.student.enrollment.academicrecord.dto.LoadInfo;
6 import org.kuali.student.enrollment.courseregistration.dto.CourseRegistrationInfo;
7 import org.kuali.student.r2.common.dto.ContextInfo;
8 import org.kuali.student.r2.common.exceptions.OperationFailedException;
9
10
11
12
13
14 public class LoadCalculatorCode4TiersImpl extends LoadCalculatorAbstractImpl implements LoadCalculator {
15
16 @Override
17 public LoadInfo calculateLoad(List<CourseRegistrationInfo> courseRegistrations,
18 String loadLevelTypeKey,
19 ContextInfo contextInfo)
20 throws OperationFailedException {
21 LoadCalculatorIntegerCreditImpl creditCalculator = new LoadCalculatorIntegerCreditImpl();
22 creditCalculator.setCourseOfferingService(this.getCourseOfferingService());
23 LoadInfo creditLoad = creditCalculator.calculateLoad(courseRegistrations, loadLevelTypeKey, contextInfo);
24
25
26
27
28
29
30 LoadInfo load = new LoadInfo(creditLoad);
31 load.setTypeKey(AcademicRecordServiceTypeStateConstants.LOAD_TYPE_CODE_4_TIER);
32 int credits = creditLoad.getTotalCredits().intValue();
33
34
35 if (credits == 0) {
36 load.setTotalCredits(new KualiDecimal (1));
37
38 return load;
39 }
40 if (credits <= 5) {
41 load.setTotalCredits(new KualiDecimal (2));
42
43 return load;
44 }
45 if (credits <= 11) {
46 load.setTotalCredits(new KualiDecimal (3));
47
48 return load;
49 }
50 load.setTotalCredits(new KualiDecimal (4));
51
52 return load;
53 }
54 }