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 | |
|
15 | |
private final String value; |
16 | |
|
17 | |
private final ProgramStatus nextStatus; |
18 | |
|
19 | 0 | ProgramStatus(String value, ProgramStatus nextStatus) { |
20 | 0 | this.value = value; |
21 | 0 | this.nextStatus = nextStatus; |
22 | 0 | } |
23 | |
|
24 | |
public String getValue() { |
25 | 0 | return value; |
26 | |
} |
27 | |
|
28 | |
public ProgramStatus getNextStatus() { |
29 | 0 | return nextStatus; |
30 | |
} |
31 | |
|
32 | |
public static ProgramStatus of(String value) { |
33 | 0 | for (ProgramStatus status : values()) { |
34 | 0 | if (status.getValue().equalsIgnoreCase(value)) { |
35 | 0 | return status; |
36 | |
} |
37 | |
} |
38 | 0 | return null; |
39 | |
} |
40 | |
|
41 | |
public static ProgramStatus of(DataModel programModel) { |
42 | 0 | return of(ProgramUtils.getProgramState(programModel)); |
43 | |
} |
44 | |
} |