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