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