| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ActionType | 
 | 
 | 2.5;2.5 | 
| 1 |  package org.kuali.student.lum.program.client.major; | |
| 2 | ||
| 3 |  import java.util.ArrayList; | |
| 4 |  import java.util.List; | |
| 5 | ||
| 6 |  import org.kuali.student.common.ui.client.application.Application; | |
| 7 |  import org.kuali.student.lum.program.client.ProgramMsgConstants; | |
| 8 | ||
| 9 |  /** | |
| 10 |   * @author Igor | |
| 11 |   */ | |
| 12 | 0 |  public enum ActionType { | 
| 13 | 0 |      NO_ACTION(ProgramMsgConstants.PROGRAMACTION_TITLE), | 
| 14 | 0 |      MODIFY(ProgramMsgConstants.PROGRAMACTION_MODIFY), | 
| 15 | 0 |      RETIRE(ProgramMsgConstants.PROGRAMACTION_RETIRE), | 
| 16 | 0 |      MODIFY_VERSION(ProgramMsgConstants.PROGRAMACTION_MODIFYVERSION), | 
| 17 | 0 |      PROPOSED_PROGRAM_MODIFICATION(ProgramMsgConstants.PROGRAMACTION_PROPOSEDPROGRAMMODIFICATION); | 
| 18 | ||
| 19 | private final String value; | |
| 20 | ||
| 21 | 0 |      ActionType(String value) { | 
| 22 | 0 |          this.value = value; | 
| 23 | 0 |      } | 
| 24 | ||
| 25 |      public String getValue() { | |
| 26 | 0 |          return Application.getApplicationContext().getUILabel(ProgramMsgConstants.PROGRAM_MSG_GROUP, value); | 
| 27 | } | |
| 28 | ||
| 29 |      /** | |
| 30 |       * This method will send back a list of values to populate the action box | |
| 31 |       * drop-down with.   | |
| 32 |       * <p> | |
| 33 |       * The list may differ between core, credential, and major discipline type programs. | |
| 34 |       * <p> | |
| 35 |       * The list may differ if you are working on the latest (most recent) version or a | |
| 36 |       * historical version. | |
| 37 |       *  | |
| 38 |       * @param latestVersion we are working with the most recent version of the program | |
| 39 |       * @return | |
| 40 |       */ | |
| 41 | public static List<String> getValuesForMajorDiscipline(boolean islatestVersion){ | |
| 42 |          // There is a states page which shows valid states.  Mike needs to update it. | |
| 43 |          // It is at: https://wiki.kuali.org/display/KULSTG/Course%2C+Proposal%2C+and+Program+Action+Dropdown+Items | |
| 44 |          // NOTE: Use same states as "Modify with Version" on page above (it is equivalent to modify with proposal) | |
| 45 | ||
| 46 | 0 |          if (islatestVersion){ | 
| 47 | 0 |              List<String> values = new ArrayList<String>(); | 
| 48 | 0 |              values.add(NO_ACTION.getValue()); | 
| 49 | 0 |              values.add(MODIFY.getValue()); | 
| 50 | 0 |              values.add(RETIRE.getValue()); | 
| 51 | 0 |              return values; | 
| 52 |          } else { | |
| 53 | 0 |              List<String> values = new ArrayList<String>(); | 
| 54 | 0 |              values.add(NO_ACTION.getValue()); | 
| 55 | 0 |              values.add(MODIFY.getValue()); | 
| 56 | 0 |              values.add(RETIRE.getValue()); | 
| 57 | 0 |              return values; | 
| 58 | } | |
| 59 | } | |
| 60 |      /** | |
| 61 |       * This method will send back a list of values to populate the action box | |
| 62 |       * drop-down with.   | |
| 63 |       * <p> | |
| 64 |       * The list may differ between core, credential, and major discipline type programs. | |
| 65 |       * <p> | |
| 66 |       * The list may differ if you are working on the latest (most recent) version or a | |
| 67 |       * historical version. | |
| 68 |       *  | |
| 69 |       * @param latestVersion we are working with the most recent version of the program | |
| 70 |       * @return | |
| 71 |       */ | |
| 72 | public static List<String> getValuesForCredentialProgram(boolean islatestVersion){ | |
| 73 |          // There is a states page which shows valid states.  Mike needs to update it. | |
| 74 |          // It is at: https://wiki.kuali.org/display/KULSTG/Course%2C+Proposal%2C+and+Program+Action+Dropdown+Items | |
| 75 |          // NOTE: Use same states as "Modify with Version" on page above (it is equivalent to modify with proposal) | |
| 76 | ||
| 77 | 0 |          if (islatestVersion){ | 
| 78 | 0 |              List<String> values = new ArrayList<String>(); | 
| 79 | 0 |              values.add(NO_ACTION.getValue()); | 
| 80 | 0 |              values.add(MODIFY.getValue()); | 
| 81 | 0 |              values.add(MODIFY_VERSION.getValue()); | 
| 82 | 0 |              return values; | 
| 83 |          } else { | |
| 84 | 0 |              List<String> values = new ArrayList<String>(); | 
| 85 | 0 |              values.add(NO_ACTION.getValue()); | 
| 86 | 0 |              values.add(MODIFY.getValue()); | 
| 87 | 0 |              return values; | 
| 88 | } | |
| 89 | } | |
| 90 | ||
| 91 |      /** | |
| 92 |       * This method will send back a list of values to populate the action box | |
| 93 |       * drop-down with.   | |
| 94 |       * <p> | |
| 95 |       * The list may differ between core, credential, and major discipline type programs. | |
| 96 |       * <p> | |
| 97 |       * The list may differ if you are working on the latest (most recent) version or a | |
| 98 |       * historical version. | |
| 99 |       *  | |
| 100 |       * @param latestVersion we are working with the most recent version of the program | |
| 101 |       * @return | |
| 102 |       */ | |
| 103 | public static List<String> getValuesForCoreProgram(boolean islatestVersion){ | |
| 104 |          // There is a states page which shows valid states.  Mike needs to update it. | |
| 105 |          // It is at: https://wiki.kuali.org/display/KULSTG/Course%2C+Proposal%2C+and+Program+Action+Dropdown+Items | |
| 106 |          // NOTE: Use same states as "Modify with Version" on page above (it is equivalent to modify with proposal) | |
| 107 | ||
| 108 | 0 |          if (islatestVersion){ | 
| 109 | 0 |              List<String> values = new ArrayList<String>(); | 
| 110 | 0 |              values.add(NO_ACTION.getValue()); | 
| 111 | 0 |              values.add(MODIFY.getValue()); | 
| 112 | 0 |              values.add(MODIFY_VERSION.getValue()); | 
| 113 | 0 |              return values; | 
| 114 |          } else { | |
| 115 | 0 |              List<String> values = new ArrayList<String>(); | 
| 116 | 0 |              values.add(NO_ACTION.getValue()); | 
| 117 | 0 |              values.add(MODIFY.getValue()); | 
| 118 | 0 |              return values; | 
| 119 | } | |
| 120 | } | |
| 121 | ||
| 122 | ||
| 123 | ||
| 124 | public static ActionType of(String value) { | |
| 125 | 0 |          for (ActionType actionType : values()) { | 
| 126 | 0 |              if (actionType.getValue().equals(value)) { | 
| 127 | 0 |                  return actionType; | 
| 128 | } | |
| 129 | } | |
| 130 | 0 |          return null; | 
| 131 | } | |
| 132 | } |