001
014
015 package com.liferay.portal.kernel.backgroundtask;
016
017 import com.liferay.portal.kernel.util.StringPool;
018
019
023 public class BackgroundTaskConstants {
024
025 public static final String LABEL_CANCELLED = "cancelled";
026
027 public static final String LABEL_FAILED = "failed";
028
029 public static final String LABEL_IN_PROGRESS = "in-progress";
030
031 public static final String LABEL_NEW = "new";
032
033 public static final String LABEL_QUEUED = "queued";
034
035 public static final String LABEL_SUCCESSFUL = "successful";
036
037 public static final int STATUS_CANCELLED = 5;
038
039 public static final int STATUS_FAILED = 2;
040
041 public static final int STATUS_IN_PROGRESS = 1;
042
043 public static final int STATUS_NEW = 0;
044
045 public static final int STATUS_QUEUED = 4;
046
047 public static final int STATUS_SUCCESSFUL = 3;
048
049 public static String getStatusCssClass(int status) {
050 if (status == STATUS_CANCELLED) {
051 return "label-info";
052 }
053 else if (status == STATUS_FAILED) {
054 return "label-important";
055 }
056 else if (status == STATUS_IN_PROGRESS) {
057 return "label-warning";
058 }
059 else if ((status == BackgroundTaskConstants.STATUS_NEW) ||
060 (status == BackgroundTaskConstants.STATUS_QUEUED)) {
061
062 return "label-info";
063 }
064 else if (status == STATUS_SUCCESSFUL) {
065 return "label-success";
066 }
067
068 return StringPool.BLANK;
069 }
070
071 public static String getStatusLabel(int status) {
072 if (status == STATUS_CANCELLED) {
073 return LABEL_CANCELLED;
074 }
075 else if (status == STATUS_FAILED) {
076 return LABEL_FAILED;
077 }
078 else if (status == STATUS_IN_PROGRESS) {
079 return LABEL_IN_PROGRESS;
080 }
081 else if (status == STATUS_NEW) {
082 return LABEL_NEW;
083 }
084 else if (status == STATUS_QUEUED) {
085 return LABEL_QUEUED;
086 }
087 else if (status == STATUS_SUCCESSFUL) {
088 return LABEL_SUCCESSFUL;
089 }
090 else {
091 return StringPool.BLANK;
092 }
093 }
094
095 }