package com.writchie.quartz.util;
public class CronExpConversion {
/**
* 页面设置转为UNIX cron expressions 转换算法
*
* @param everyWhat
* @param commonNeeds
* 包括 second minute hour
* @param monthlyNeeds
* 包括 第几个星期 星期几
* @param weeklyNeeds
* 包括 星期几
* @param userDefinedNeeds
* 包括具体时间点
* @return cron expression
* /
public static String convertDateToCronExp(String everyWhat,
String[] commonNeeds, String[] monthlyNeeds, String weeklyNeeds,
String userDefinedNeeds) {
String cronEx = "";
String commons = commonNeeds[0] + " " + commonNeeds[1] + " "
+ commonNeeds[2] + " ";
String dayOfWeek = "";
if (" monthly ".equals(everyWhat)) {
// eg.: 6#3 (day 6 = Friday and "#3" = the 3rd one in the
// month)
dayOfWeek = monthlyNeeds[1]+ CronExRelated.specialCharacters.get(CronExRelated._THENTH) + monthlyNeeds[0];
cronEx = (commons
+ CronExRelated.specialCharacters.get(CronExRelated._ANY)
+ " "
+ CronExRelated.specialCharacters.get(CronExRelated._EVERY)
+ " " + dayOfWeek + " ").trim();
} else if (" weekly ".equals(everyWhat)) {
dayOfWeek = weeklyNeeds; // 1
cronEx = (commons
+ CronExRelated.specialCharacters.get(CronExRelated._ANY)
+ " "
+ CronExRelated.specialCharacters.get(CronExRelated._EVERY)
+ " " + dayOfWeek + " ").trim();
} else if (" userDefined ".equals(everyWhat)) {
String dayOfMonth = userDefinedNeeds.split(" - ")[2];
if (dayOfMonth.startsWith(" 0 ")) {
dayOfMonth = dayOfMonth.replaceFirst(" 0 ", "");
}
String month = userDefinedNeeds.split(" - ")[1];
if (month.startsWith(" 0 ")) {
month = month.replaceFirst(" 0 ", "");
}
String year = userDefinedNeeds.split(" - ")[0];
// FIXME 暂时不加年份 Quartz报错
/*
* cronEx = (commons + dayOfMonth + " " + month + " " +
* CronExRelated.specialCharacters.get(CronExRelated._ANY) + " " +
* year).trim();
* /
cronEx = (commons + dayOfMonth + " " + month + " "
+ CronExRelated.specialCharacters.get(CronExRelated._ANY) + " ")
.trim();
}
return cronEx;
}*/
}
没有合适的资源?快使用搜索试试~ 我知道了~
SpringQuartz实例
共30个文件
class:7个
java:7个
jar:6个
5星 · 超过95%的资源 需积分: 9 66 下载量 35 浏览量
2011-12-06
09:24:50
上传
评论
收藏 4.31MB ZIP 举报
温馨提示
开发spring quartz 实例,包括多个job任务,同时附带截止目前最新最全的开发jar,包括commons-collections,commons-logging-1.1.1,quartz-1.7.3,spring-2.5.6,spring-context-3.0.6.RELEASE-sources,spring-webmvc-2.5.6
资源推荐
资源详情
资源评论
收起资源包目录
testquartz.zip (30个子文件)
testquartz
src
july-servlet.xml 3KB
com
writchie
quartz
trigger
ScheduleInfoManagerImpl.java 2KB
ScheduleInfoManager.java 396B
action
ScheduleInfoAction.java 537B
test
QuartzService.java 543B
QuartzJob.java 1005B
QuartzJobTwo.java 220B
util
CronExpConversion.java 2KB
.project 1KB
WebRoot
META-INF
MANIFEST.MF 36B
WEB-INF
web.xml 1KB
july-servlet.xml 3KB
classes
july-servlet.xml 3KB
com
writchie
quartz
trigger
ScheduleInfoManagerImpl.class 2KB
ScheduleInfoManager.class 316B
action
ScheduleInfoAction.class 406B
test
QuartzService.class 1008B
QuartzJob.class 1KB
QuartzJobTwo.class 574B
util
CronExpConversion.class 326B
lib
quartz
commons-collections.jar 558KB
spring-webmvc-2.5.6.jar 393KB
commons-logging-1.1.1.jar 59KB
quartz-1.7.3.jar 410KB
spring-2.5.6.jar 2.81MB
spring-context-3.0.6.RELEASE-sources.jar 674KB
applicationContext.xml 168B
index.jsp 834B
.mymetadata 303B
.classpath 1022B
.myeclipse
共 30 条
- 1
kewei8976
- 粉丝: 6
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- js-leetcode题解之158-read-n-characters-given-read4-ii-call
- js-leetcode题解之157-read-n-characters-given-read4.js
- js-leetcode题解之156-binary-tree-upside-down.js
- js-leetcode题解之155-min-stack.js
- js-leetcode题解之154-find-minimum-in-rotated-sorted-array-ii.js
- js-leetcode题解之153-find-minimum-in-rotated-sorted-array.js
- js-leetcode题解之152-maximum-product-subarray.js
- js-leetcode题解之151-reverse-words-in-a-string.js
- js-leetcode题解之150-evaluate-reverse-polish-notation.js
- js-leetcode题解之149-max-points-on-a-line.js
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页