1 package org.kuali.student.core.dto;
2
3 public class DtoConstants {
4
5 public static final String DTO_STATE = "DtoState";
6 public static final String DTO_NEXT_STATE = "DtoNextState";
7
8
9 public enum DtoState {
10 DRAFT, SUBMITTED, APPROVED, ACTIVE, INACTIVE, RETIRED, SUPERSEDED, SAVED, ENROUTE;
11
12 public boolean equalsString(String state){
13 if (state != null){
14 return this.toString().equals(state.toUpperCase());
15 }
16
17 return false;
18 }
19
20
21
22
23
24
25
26
27
28
29 public static DtoState getNextState(String state){
30
31 if (DRAFT.equalsString(state)) {
32 return SUBMITTED;
33 } else if (SUBMITTED.equalsString(state)) {
34 return APPROVED;
35 } else if (APPROVED.equalsString(state)) {
36 return ACTIVE;
37 } else if (ACTIVE.equalsString(state)) {
38 return INACTIVE;
39 } else if (INACTIVE.equalsString(state)) {
40 return RETIRED;
41
42
43 } else if (SAVED.equalsString(state)) {
44 return ENROUTE;
45 } else if (ENROUTE.equalsString(state)) {
46 return APPROVED;
47 }
48
49
50 return null;
51 }
52
53 public static String getNextStateAsString(String state){
54 DtoState dtoState = getNextState(state);
55 if (dtoState == null){
56 return null;
57 } else {
58 return dtoState.toString();
59 }
60 }
61 }
62 }