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