1 package org.kuali.student.lum.program.client;
2
3 import org.kuali.student.common.ui.client.mvc.DataModel;
4
5
6
7
8 public enum ProgramStatus {
9 SUPERSEDED(ProgramMsgConstants.STATUS_SUPERSEDED, null),
10 ACTIVE(ProgramMsgConstants.STATUS_ACTIVE, SUPERSEDED),
11 APPROVED(ProgramMsgConstants.STATUS_APPROVED, ACTIVE),
12 DRAFT(ProgramMsgConstants.STATUS_DRAFT, APPROVED),
13 NOTAPPROVED(ProgramMsgConstants.STATUS_NOTAPPROVED, null);
14
15 private final String value;
16
17 private final ProgramStatus nextStatus;
18
19 ProgramStatus(String value, ProgramStatus nextStatus) {
20 this.value = value;
21 this.nextStatus = nextStatus;
22 }
23
24 public String getValue() {
25 return value;
26 }
27
28 public ProgramStatus getNextStatus() {
29 return nextStatus;
30 }
31
32 public static ProgramStatus of(String value) {
33 for (ProgramStatus status : values()) {
34 if (status.getValue().equalsIgnoreCase(value)) {
35 return status;
36 }
37 }
38 return null;
39 }
40
41 public static ProgramStatus of(DataModel programModel) {
42 return of(ProgramUtils.getProgramState(programModel));
43 }
44 }