1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.student.r2.common.dto; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
@Deprecated |
26 | 0 | public class DtoConstants { |
27 | |
|
28 | |
public final static String STATE_DRAFT = "Draft"; |
29 | |
public final static String STATE_SUBMITTED = "Submitted"; |
30 | |
public final static String STATE_WITHDRAWN = "Withdrawn"; |
31 | |
public final static String STATE_APPROVED = "Approved"; |
32 | |
public final static String STATE_NOT_APPROVED = "Not Approved"; |
33 | |
public final static String STATE_ACTIVE = "Active"; |
34 | |
public final static String STATE_INACTIVE = "Inactive"; |
35 | |
public final static String STATE_SUPERSEDED = "Superseded"; |
36 | |
public final static String STATE_SUSPENDED = "Suspended"; |
37 | |
public final static String STATE_RETIRED = "Retired"; |
38 | |
|
39 | |
|
40 | |
public static final String DTO_STATE = "DtoState"; |
41 | |
public static final String DTO_NEXT_STATE = "DtoNextState"; |
42 | |
|
43 | |
|
44 | 0 | public enum DtoState { |
45 | 0 | DRAFT, SUBMITTED, APPROVED, ACTIVE, INACTIVE, RETIRED, SUPERSEDED, SAVED, ENROUTE; |
46 | |
|
47 | |
public boolean equalsString(String state) { |
48 | 0 | if (state != null) { |
49 | 0 | return this.toString().equals(state.toUpperCase()); |
50 | |
} |
51 | |
|
52 | 0 | return false; |
53 | |
} |
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
public static DtoState getNextState(String state) { |
66 | |
|
67 | 0 | if (DRAFT.equalsString(state)) { |
68 | 0 | return SUBMITTED; |
69 | 0 | } else if (SUBMITTED.equalsString(state)) { |
70 | 0 | return APPROVED; |
71 | 0 | } else if (APPROVED.equalsString(state)) { |
72 | 0 | return ACTIVE; |
73 | 0 | } else if (ACTIVE.equalsString(state)) { |
74 | 0 | return INACTIVE; |
75 | 0 | } else if (INACTIVE.equalsString(state)) { |
76 | 0 | return RETIRED; |
77 | |
|
78 | |
|
79 | 0 | } else if (SAVED.equalsString(state)) { |
80 | 0 | return ENROUTE; |
81 | 0 | } else if (ENROUTE.equalsString(state)) { |
82 | 0 | return APPROVED; |
83 | |
} |
84 | |
|
85 | 0 | return null; |
86 | |
} |
87 | |
|
88 | |
public static String getNextStateAsString(String state) { |
89 | 0 | DtoState dtoState = getNextState(state); |
90 | 0 | if (dtoState == null) { |
91 | 0 | return null; |
92 | |
} else { |
93 | 0 | return dtoState.toString(); |
94 | |
} |
95 | |
} |
96 | |
} |
97 | |
} |