Java 类org.quartz.impl.calendar.BaseCalendar 实例源码

项目:uflo    文件:SchedulerServiceImpl.java   
public Calendar buildCalendar(List<CalendarInfo> infos) {
    MultipleCalendar mulCalendar=null;
    Collection<CalendarProvider> providers=applicationContext.getBeansOfType(CalendarProvider.class).values();
    for(CalendarInfo info:infos){
        for(CalendarProvider provider:providers){
            Calendar calendar=provider.getCalendar(info.getId());
            if(calendar!=null){
                if(mulCalendar==null){
                    mulCalendar=new MultipleCalendar();;
                }
                mulCalendar.addCalendar((BaseCalendar)calendar);
            }
        }
    }
    return mulCalendar;
}
项目:motech    文件:MotechSchedulerServiceImpl.java   
@Override
public List<DateTime> getScheduledJobTimingsWithPrefix(
        String subject, String externalJobIdPrefix, DateTime startDate, DateTime endDate) {

    JobId jobId = new CronJobId(subject, externalJobIdPrefix);
    List<Date> messageTimings = new ArrayList<>();
    try {
        List<TriggerKey> triggerKeys = new ArrayList<TriggerKey>(
                scheduler.getTriggerKeys(GroupMatcher.triggerGroupContains(JOB_GROUP_NAME)));
        for (TriggerKey triggerKey : triggerKeys) {
            if (StringUtils.isNotEmpty(externalJobIdPrefix) && triggerKey.getName().contains(jobId.value())) {
                Trigger trigger = scheduler.getTrigger(triggerKey);
                messageTimings.addAll(TriggerUtils.computeFireTimesBetween(
                        (OperableTrigger) trigger, new BaseCalendar(), DateUtil.toDate(startDate), DateUtil.toDate(endDate)));
            }
        }

    } catch (SchedulerException e) {
        throw new MotechSchedulerException(String.format(
                "Can not get scheduled job timings given subject and externalJobIdPrefix for dates : %s %s %s %s %s",
                subject, externalJobIdPrefix, startDate.toString(), endDate.toString(), e.getMessage()), e);
    }

    return DateUtil.datesToDateTimes(messageTimings);
}
项目:bdf2    文件:MultipleCalendar.java   
public void addCalendar(BaseCalendar calendar){
    if(calendar instanceof DailyCalendar){
        dailyCalendars.add((DailyCalendar)calendar);
    }else{
        calendars.add(calendar);
    }
}
项目:uflo    文件:MultipleCalendar.java   
public void addCalendar(BaseCalendar calendar){
    if(calendar instanceof WorkdayCalendar){
        workdayCalendars.add((WorkdayCalendar)calendar);
    }else if(calendar instanceof DailyCalendar){
        dailyCalendars.add((DailyCalendar)calendar);
    }else{
        calendars.add(calendar);
    }
}
项目:motech    文件:MotechSchedulerServiceImpl.java   
@Override
public List<DateTime> getScheduledJobTimings(String subject, String externalJobId, DateTime startDate, DateTime endDate) {
    JobId jobId = new CronJobId(subject, externalJobId);
    Trigger trigger;
    try {
        trigger = scheduler.getTrigger(triggerKey(jobId.value(), JOB_GROUP_NAME));
        return DateUtil.datesToDateTimes(TriggerUtils.computeFireTimesBetween(
                (OperableTrigger) trigger, new BaseCalendar(), DateUtil.toDate(startDate), DateUtil.toDate(endDate)));

    } catch (SchedulerException e) {
        throw new MotechSchedulerException(String.format(
                "Can not get scheduled job timings given subject and externalJobId for dates : %s %s %s %s %s",
                subject, externalJobId, startDate.toString(), endDate.toString(), e.getMessage()), e);
    }
}
项目:quartz-scheduler-hazelcast-jobstore    文件:AbstractTest.java   
protected void storeCalendar(String calName)
  throws ObjectAlreadyExistsException, JobPersistenceException {

  jobStore.storeCalendar(calName, new BaseCalendar(), false, false);
}
项目:quartz-hazelcast-jobstore    文件:TestHazelcastJobStore.java   
@Test
public void testClearAllSchedulingData() throws JobPersistenceException {
  assertThat(jobStore.getNumberOfJobs()).isEqualTo(0);

  assertThat(jobStore.getNumberOfTriggers()).isEqualTo(0);

  assertThat(jobStore.getNumberOfCalendars()).isEqualTo(0);

  final String jobName = "job40";
  final JobDetail storeJob = storeJob(jobName);
  assertThat(jobStore.getNumberOfJobs()).isEqualTo(1);

  jobStore.storeTrigger((OperableTrigger) buildTrigger(storeJob), false);
  assertThat(jobStore.getNumberOfTriggers()).isEqualTo(1);

  jobStore.storeCalendar("calendar", new BaseCalendar(), false, false);
  assertThat(jobStore.getNumberOfCalendars()).isEqualTo(1);

  jobStore.clearAllSchedulingData();
  assertThat(jobStore.getNumberOfJobs()).isEqualTo(0);

  assertThat(jobStore.getNumberOfTriggers()).isEqualTo(0);

  assertThat(jobStore.getNumberOfCalendars()).isEqualTo(0);
}
项目:quartz-hazelcast-jobstore    文件:AbstractTestHazelcastJobStore.java   
protected void storeCalendar(String calName)
    throws ObjectAlreadyExistsException, JobPersistenceException {
  jobStore.storeCalendar(calName, new BaseCalendar(), false, false);
}
项目:quartz-scheduler-hazelcast-jobstore    文件:HazelcastJobStoreTest.java   
@Test
public void testClearAllSchedulingData()
  throws JobPersistenceException {

  assertEquals(jobStore.getNumberOfJobs(), 0);

  assertEquals(jobStore.getNumberOfTriggers(), 0);

  assertEquals(jobStore.getNumberOfCalendars(), 0);

  final String jobName = "job40";
  final JobDetail storeJob = storeJob(jobName);
  assertEquals(jobStore.getNumberOfJobs(), 1);

  jobStore.storeTrigger((OperableTrigger) buildTrigger(storeJob), false);
  assertEquals(jobStore.getNumberOfTriggers(), 1);

  jobStore.storeCalendar("calendar", new BaseCalendar(), false, false);
  assertEquals(jobStore.getNumberOfCalendars(), 1);

  jobStore.clearAllSchedulingData();
  assertEquals(jobStore.getNumberOfJobs(), 0);

  assertEquals(jobStore.getNumberOfTriggers(), 0);

  assertEquals(jobStore.getNumberOfCalendars(), 0);
}