Package org.quartz

Examples of org.quartz.TriggerBuilder


                           .withIdentity("Job" + i, Scheduler.DEFAULT_GROUP)
                           .withDescription(description)
                           .requestRecovery(recoverable)
                           .storeDurably(durable)
                           .build();
        final TriggerBuilder tb = TriggerBuilder.newTrigger()
                                                .forJob(detail)
                                                .withIdentity("Trigger" + i, Scheduler.DEFAULT_GROUP)
                                                .withDescription(description);
        if (startTime != null) {
            tb.startAt(parse(startTime));
        }

        if (endTime != null) {
            tb.endAt(parse(endTime));
        }

        if (calendarName != null) {
            tb.modifiedByCalendar(calendarName);
        }

        final CronScheduleBuilder csb = CronScheduleBuilder.cronSchedule(getCronExpression());
        if (timeZone != null) {
            csb.inTimeZone(TimeZone.getTimeZone(timeZone));
        }

        trigger = tb.withSchedule(csb).build();

        try {
            ((CronTriggerImpl) trigger).validate();
        } catch (SchedulerException e) {
            throw new InvalidPropertyException(e);
View Full Code Here


    }
  }// ;

  @SuppressWarnings({ "rawtypes", "unchecked" })
  protected Trigger buildTrigger(BatchSchedule sch) {
    TriggerBuilder tirggerBuilder = TriggerBuilder.newTrigger()
        .withIdentity(sch.getSchId()).withPriority(sch.getPriority());
    if ("T".equals(sch.getSchType())) {
      tirggerBuilder.withSchedule(
          SimpleScheduleBuilder.simpleSchedule()
              .withIntervalInSeconds(sch.getRepeatInterval())
              .withRepeatCount(sch.getRepeatCount())).startAt(
          new Date(System.currentTimeMillis() + 60000));

    } else if ("C".equals(sch.getSchType())) {
      tirggerBuilder.withSchedule(CronScheduleBuilder.cronSchedule(
          sch.getCronExpression()).inTimeZone(
          TimeZone.getTimeZone(sch.getTimeZoneId())));
    }
    return tirggerBuilder.build();
  }// ;
View Full Code Here

                .withIdentity("Job" + i, Scheduler.DEFAULT_GROUP)
                .withDescription(description)
                .requestRecovery(recoverable)
                .storeDurably(durable)
                .build();
        final TriggerBuilder tb = TriggerBuilder.newTrigger()
                .forJob(detail)
                .withIdentity("Trigger" + i, Scheduler.DEFAULT_GROUP)
                .withDescription(description);
        if (startTime != null) {
                tb.startAt(parse(startTime));
        }
        if (endTime != null) {
                tb.endAt(parse(endTime));
        }
        if (calendarName != null) {
                tb.modifiedByCalendar(calendarName);
        }
        final CronScheduleBuilder csb = CronScheduleBuilder.cronSchedule(getCronExpression());
        if (timeZone != null) {
            csb.inTimeZone(TimeZone.getTimeZone(timeZone));
        }
        tb.withSchedule(CronScheduleBuilder.cronSchedule(getCronExpression()));
        trigger = tb.build();
       

        try {
            ((CronTriggerImpl) trigger).validate();
        } catch (SchedulerException e) {
View Full Code Here

TOP

Related Classes of org.quartz.TriggerBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.