taskhelper.java
来自「OBPM是一个开源」· Java 代码 · 共 117 行
JAVA
117 行
package cn.myapps.core.task.action;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import cn.myapps.core.task.ejb.Task;
import cn.myapps.core.task.ejb.TaskConstants;
import cn.myapps.util.timer.TimerRunner;
public class TaskHelper {
public String getStartupName(int startupType) { // 启动类型名称
String name = "";
switch (startupType) {
case TaskConstants.STARTUP_TYPE_MANUAL:
name = "Manul";
break;
case TaskConstants.STARTUP_TYPE_AUTO:
name = "Auto";
break;
case TaskConstants.STARTUP_TYPE_BANNED:
name = "Banned";
break;
default:
break;
}
return name;
}
public Collection getTimeList() {
Collection timelist = new ArrayList();
int hour = 23;
for (int i = 0; i < hour; i++) {
timelist.add(i + ":00");
timelist.add(i + ":30");
}
return timelist;
}
public Collection getHourList() {
Collection hourList = new ArrayList();
for (int i = 1; i <= 24; i++) {
hourList.add(new Integer(i));
}
return hourList;
}
public Collection getMinuteList() {
Collection minuteList = new ArrayList();
for (int i = 0; i <= 60; i++) {
minuteList.add(new Integer(i));
}
return minuteList;
}
public Collection getSecondList() {
Collection secondList = new ArrayList();
for (int i = 0; i <= 60; i++) {
secondList.add(new Integer(i));
}
return secondList;
}
public Map getDayOfWeekList() {
Map rtn = new LinkedHashMap();
rtn.put("1", "Sunday");
rtn.put("2", "Monday");
rtn.put("3", "Tuesday");
rtn.put("4", "Wednesday");
rtn.put("5", "Thursday");
rtn.put("6", "Friday");
rtn.put("7", "Saturday");
return rtn;
}
public Collection getDayOfMonthList() {
Collection rtn = new ArrayList();
for (int i = 1; i <= 31; i++) {
rtn.add(new Integer(i));
}
return rtn;
}
public static String getPeriodName(int periodType) {
return TaskConstants.getPeriodName(periodType);
}
public static String getPeriodName(Object periodType) {
if (periodType instanceof Integer) {
int type = ((Integer)periodType).intValue();
return getPeriodName(type);
}
return "";
}
public static String getStateName(String taskid) { // 状态名称
Collection runningList = TimerRunner.runningList.keySet();
for (Iterator iter = runningList.iterator(); iter.hasNext();) {
Task runningTask = (Task)iter.next();
if (runningTask.getId().equals(taskid)) {
return TaskConstants.RUNNING;
}
}
return TaskConstants.STOPPING;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?