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