Example #1
0
 public static MSTaskInfo convert(TaskInfo taskInfo) {
   MSTaskInfo msTaskInfo = new MSTaskInfo();
   msTaskInfo.setName(taskInfo.getName());
   TriggerInfo triggerInfo = taskInfo.getTriggerInfo();
   msTaskInfo.setCronExpression(triggerInfo.getCronExpression());
   msTaskInfo.setStartTime(dateToCal(triggerInfo.getStartTime()));
   msTaskInfo.setEndTime(dateToCal(triggerInfo.getEndTime()));
   msTaskInfo.setTaskCount(triggerInfo.getRepeatCount());
   msTaskInfo.setTaskInterval(triggerInfo.getIntervalMillis());
   return msTaskInfo;
 }
Example #2
0
 public static TaskInfo convert(MSTaskInfo msTaskInfo) {
   TriggerInfo triggerInfo = new TriggerInfo();
   triggerInfo.setCronExpression(msTaskInfo.getCronExpression());
   if (msTaskInfo.getStartTime() != null) {
     triggerInfo.setStartTime(msTaskInfo.getStartTime().getTime());
   }
   if (msTaskInfo.getEndTime() != null) {
     triggerInfo.setEndTime(msTaskInfo.getEndTime().getTime());
   }
   triggerInfo.setIntervalMillis((int) msTaskInfo.getTaskInterval());
   triggerInfo.setRepeatCount(msTaskInfo.getTaskCount());
   return new TaskInfo(
       msTaskInfo.getName(), MSTask.class.getName(), msTaskInfo.getTaskProperties(), triggerInfo);
 }