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