View Javadoc
1   package org.kuali.student.enrollment.rules.credit.limit;
2   
3   import java.util.List;
4   import org.kuali.student.r2.common.dto.ContextInfo;
5   import org.kuali.student.r2.common.exceptions.OperationFailedException;
6   
7   /**
8    * this calculates the state key based on the actions
9    */
10  public class LoadStateKeyCalculator  {
11  
12  
13      public String calcStateKey(List<CourseRegistrationTransaction> actions,
14              String loadLevelTypeKey,
15              ContextInfo contextInfo)
16              throws OperationFailedException {
17          for (CourseRegistrationTransaction action : actions) {
18              switch (action.getAction()) {
19                  case NO_CHANGE:
20                      continue;
21                  case CREATE:
22                  case UPDATE:
23                  case DELETE:
24                      return AcademicRecordServiceTypeStateConstants.LOAD_STATE_PRELIMIARY;
25                  default:
26                      throw new OperationFailedException(action.toString());
27  
28              }
29          }
30          return AcademicRecordServiceTypeStateConstants.LOAD_STATE_FINAL;
31      }
32  
33  }