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 BACKGROUND_TASK_ID = "backgroundTaskId";
026
027 public static final int ISOLATION_LEVEL_CLASS = 1;
028
029 public static final int ISOLATION_LEVEL_COMPANY = 2;
030
031 public static final int ISOLATION_LEVEL_GROUP = 3;
032
033 public static final int ISOLATION_LEVEL_NOT_ISOLATED = 4;
034
035 public static final int ISOLATION_LEVEL_TASK_NAME = 5;
036
037 public static final String LABEL_CANCELLED = "cancelled";
038
039 public static final String LABEL_FAILED = "failed";
040
041 public static final String LABEL_IN_PROGRESS = "in-progress";
042
043 public static final String LABEL_NEW = "new";
044
045 public static final String LABEL_QUEUED = "queued";
046
047 public static final String LABEL_SUCCESSFUL = "successful";
048
049 public static final int STATUS_CANCELLED = 5;
050
051 public static final int STATUS_FAILED = 2;
052
053 public static final int STATUS_IN_PROGRESS = 1;
054
055 public static final int STATUS_NEW = 0;
056
057 public static final int STATUS_QUEUED = 4;
058
059 public static final int STATUS_SUCCESSFUL = 3;
060
061 public static String getStatusCssClass(int status) {
062 if (status == STATUS_CANCELLED) {
063 return "text-info";
064 }
065 else if (status == STATUS_FAILED) {
066 return "text-danger";
067 }
068 else if (status == STATUS_IN_PROGRESS) {
069 return "text-warning";
070 }
071 else if ((status == BackgroundTaskConstants.STATUS_NEW) ||
072 (status == BackgroundTaskConstants.STATUS_QUEUED)) {
073
074 return "text-info";
075 }
076 else if (status == STATUS_SUCCESSFUL) {
077 return "text-success";
078 }
079
080 return StringPool.BLANK;
081 }
082
083 public static String getStatusLabel(int status) {
084 if (status == STATUS_CANCELLED) {
085 return LABEL_CANCELLED;
086 }
087 else if (status == STATUS_FAILED) {
088 return LABEL_FAILED;
089 }
090 else if (status == STATUS_IN_PROGRESS) {
091 return LABEL_IN_PROGRESS;
092 }
093 else if (status == STATUS_NEW) {
094 return LABEL_NEW;
095 }
096 else if (status == STATUS_QUEUED) {
097 return LABEL_QUEUED;
098 }
099 else if (status == STATUS_SUCCESSFUL) {
100 return LABEL_SUCCESSFUL;
101 }
102 else {
103 return StringPool.BLANK;
104 }
105 }
106
107 }