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