001
014
015 package com.liferay.portal.kernel.workflow;
016
017
021 public class WorkflowConstants {
022
023 public static final int ACTION_PUBLISH = 1;
024
025 public static final int ACTION_SAVE_DRAFT = 2;
026
027 public static final String CONTEXT_COMMAND = "command";
028
029 public static final String CONTEXT_COMPANY_ID = "companyId";
030
031 public static final String CONTEXT_ENTRY_CLASS_NAME = "entryClassName";
032
033 public static final String CONTEXT_ENTRY_CLASS_PK = "entryClassPK";
034
035 public static final String CONTEXT_ENTRY_TYPE = "entryType";
036
037 public static final String CONTEXT_GROUP_ID = "groupId";
038
039 public static final String CONTEXT_NOTIFICATION_SENDER_ADDRESS =
040 "notificationSenderAddress";
041
042 public static final String CONTEXT_NOTIFICATION_SENDER_NAME =
043 "notificationSenderName";
044
045 public static final String CONTEXT_NOTIFICATION_SUBJECT =
046 "notificationSubject";
047
048 public static final String CONTEXT_SERVICE_CONTEXT = "serviceContext";
049
050 public static final String CONTEXT_TASK_COMMENTS = "taskComments";
051
052 public static final String CONTEXT_TRANSITION_NAME = "transitionName";
053
054 public static final String CONTEXT_URL = "url";
055
056 public static final String CONTEXT_USER_ID = "userId";
057
058 public static final String CONTEXT_USER_PORTRAIT_URL = "userPortraitURL";
059
060 public static final String CONTEXT_USER_URL = "userURL";
061
062 public static final long DEFAULT_GROUP_ID = 0;
063
064 public static final String LABEL_ANY = "any";
065
066 public static final String LABEL_APPROVED = "approved";
067
068 public static final String LABEL_DENIED = "denied";
069
070 public static final String LABEL_DRAFT = "draft";
071
072 public static final String LABEL_EXPIRED = "expired";
073
074 public static final String LABEL_IN_TRASH = "in-trash";
075
076 public static final String LABEL_INACTIVE = "inactive";
077
078 public static final String LABEL_INCOMPLETE = "incomplete";
079
080 public static final String LABEL_PENDING = "pending";
081
082 public static final String LABEL_SCHEDULED = "scheduled";
083
084 public static final int STATUS_ANY = -1;
085
086 public static final int STATUS_APPROVED = 0;
087
088 public static final int STATUS_DENIED = 4;
089
090 public static final int STATUS_DRAFT = 2;
091
092
095 @Deprecated
096 public static final int STATUS_DRAFT_FROM_APPROVED = 9;
097
098 public static final int STATUS_EXPIRED = 3;
099
100 public static final int STATUS_IN_TRASH = 8;
101
102 public static final int STATUS_INACTIVE = 5;
103
104 public static final int STATUS_INCOMPLETE = 6;
105
106 public static final int STATUS_PENDING = 1;
107
108 public static final int STATUS_SCHEDULED = 7;
109
110 public static final int TYPE_ASSIGN = 10000;
111
112 public static final int TYPE_COMPLETE = 10001;
113
114 public static int getLabelStatus(String label) {
115 if (label.equals(LABEL_ANY)) {
116 return STATUS_ANY;
117 }
118 else if (label.equals(LABEL_APPROVED)) {
119 return STATUS_APPROVED;
120 }
121 else if (label.equals(LABEL_DENIED)) {
122 return STATUS_DENIED;
123 }
124 else if (label.equals(LABEL_DRAFT)) {
125 return STATUS_DRAFT;
126 }
127 else if (label.equals(LABEL_EXPIRED)) {
128 return STATUS_EXPIRED;
129 }
130 else if (label.equals(LABEL_INACTIVE)) {
131 return STATUS_INACTIVE;
132 }
133 else if (label.equals(LABEL_IN_TRASH)) {
134 return STATUS_IN_TRASH;
135 }
136 else if (label.equals(LABEL_INCOMPLETE)) {
137 return STATUS_INCOMPLETE;
138 }
139 else if (label.equals(LABEL_PENDING)) {
140 return STATUS_PENDING;
141 }
142 else if (label.equals(LABEL_SCHEDULED)) {
143 return STATUS_SCHEDULED;
144 }
145 else {
146 return STATUS_ANY;
147 }
148 }
149
150 public static String getStatusCssClass(int status) {
151 if (status == STATUS_ANY) {
152 return LABEL_ANY;
153 }
154 else if (status == STATUS_APPROVED) {
155 return LABEL_APPROVED;
156 }
157 else if (status == STATUS_DENIED) {
158 return LABEL_DENIED;
159 }
160 else if (status == STATUS_DRAFT) {
161 return LABEL_DRAFT;
162 }
163 else if (status == STATUS_EXPIRED) {
164 return LABEL_EXPIRED;
165 }
166 else if (status == STATUS_IN_TRASH) {
167 return LABEL_IN_TRASH;
168 }
169 else if (status == STATUS_INACTIVE) {
170 return LABEL_INACTIVE;
171 }
172 else if (status == STATUS_INCOMPLETE) {
173 return LABEL_INCOMPLETE;
174 }
175 else if (status == STATUS_PENDING) {
176 return LABEL_PENDING;
177 }
178 else if (status == STATUS_SCHEDULED) {
179 return LABEL_SCHEDULED;
180 }
181 else {
182 return LABEL_ANY;
183 }
184 }
185
186 public static String getStatusLabel(int status) {
187 if (status == STATUS_ANY) {
188 return LABEL_ANY;
189 }
190 else if (status == STATUS_APPROVED) {
191 return LABEL_APPROVED;
192 }
193 else if (status == STATUS_DENIED) {
194 return LABEL_DENIED;
195 }
196 else if (status == STATUS_DRAFT) {
197 return LABEL_DRAFT;
198 }
199 else if (status == STATUS_EXPIRED) {
200 return LABEL_EXPIRED;
201 }
202 else if (status == STATUS_IN_TRASH) {
203 return LABEL_IN_TRASH;
204 }
205 else if (status == STATUS_INACTIVE) {
206 return LABEL_INACTIVE;
207 }
208 else if (status == STATUS_INCOMPLETE) {
209 return LABEL_INCOMPLETE;
210 }
211 else if (status == STATUS_PENDING) {
212 return LABEL_PENDING;
213 }
214 else if (status == STATUS_SCHEDULED) {
215 return LABEL_SCHEDULED;
216 }
217 else {
218 return LABEL_ANY;
219 }
220 }
221
222
225 @Deprecated
226 public static String toLabel(int status) {
227 return getStatusLabel(status);
228 }
229
230
233 @Deprecated
234 public static int toStatus(String label) {
235 return getLabelStatus(label);
236 }
237
238 }