View Javadoc
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   * This load calculator calculates load in terms of number of full credited courses
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          // Note: this logic is often much more complicated than this... 
26          // for example if the student is taking a thesis course
27          // the load is automatically pegged to Full Time
28          // OR... if the term is SUMMER (instead of fall or spring...) the tiers for FT/HT is different 
29          // 
30          LoadInfo load = new LoadInfo(creditLoad);
31          load.setTypeKey(AcademicRecordServiceTypeStateConstants.LOAD_TYPE_CODE_4_TIER);
32          int credits = creditLoad.getTotalCredits().intValue();
33  //      TODO: KSENROLL-11719 get the cutoff points from the GES
34  //      Might want to add a string field so we can store the level code in a string field instead of as a number.
35          if (credits == 0) {
36              load.setTotalCredits(new KualiDecimal (1));
37  //            load.setTotalCredits(AcademicRecordServiceTypeStateConstants.LOAD_CODE_4_TIER_1_NO_LOAD);
38              return load;
39          }
40          if (credits <= 5) {
41              load.setTotalCredits(new KualiDecimal (2));
42  //            load.setTotalCredits(AcademicRecordServiceTypeStateConstants.LOAD_CODE_4_TIER_2_LT_HT);
43              return load;
44          }
45          if (credits <= 11) {
46              load.setTotalCredits(new KualiDecimal (3));
47  //            load.setTotalCredits(AcademicRecordServiceTypeStateConstants.LOAD_CODE_4_TIER_3_HT);
48              return load;
49          }
50          load.setTotalCredits(new KualiDecimal (4));
51  //        load.setTotalCredits(AcademicRecordServiceTypeStateConstants.LOAD_CODE_4_TIER_4_FT);
52          return load;
53      }
54  }