Java Code Examples for javax.ejb.ScheduleExpression#month()

The following examples show how to use javax.ejb.ScheduleExpression#month() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MethodScheduleBuilder.java    From tomee with Apache License 2.0 5 votes vote down vote up
private void addSchedulesToMethod(final MethodContext methodContext, final MethodScheduleInfo info) {

        if (methodContext == null) {
            return;
        }

        for (final ScheduleInfo scheduleInfo : info.schedules) {

            final ScheduleExpression expr = new ScheduleExpression();
            expr.second(scheduleInfo.second == null ? "0" : scheduleInfo.second);
            expr.minute(scheduleInfo.minute == null ? "0" : scheduleInfo.minute);
            expr.hour(scheduleInfo.hour == null ? "0" : scheduleInfo.hour);
            expr.dayOfWeek(scheduleInfo.dayOfWeek == null ? "*" : scheduleInfo.dayOfWeek);
            expr.dayOfMonth(scheduleInfo.dayOfMonth == null ? "*" : scheduleInfo.dayOfMonth);
            expr.month(scheduleInfo.month == null ? "*" : scheduleInfo.month);
            expr.year(scheduleInfo.year == null ? "*" : scheduleInfo.year);
            expr.timezone(scheduleInfo.timezone);
            expr.start(scheduleInfo.start);
            expr.end(scheduleInfo.end);

            final TimerConfig config = new TimerConfig();
            config.setInfo(scheduleInfo.info);
            config.setPersistent(scheduleInfo.persistent);

            methodContext.getSchedules().add(new ScheduleData(config, expr));
        }

    }
 
Example 2
Source File: TimerServiceImpl.java    From tomee with Apache License 2.0 5 votes vote down vote up
private ScheduleExpression copy(final ScheduleExpression scheduleExpression) {
    final ScheduleExpression scheduleExpressionCopy = new ScheduleExpression();
    scheduleExpressionCopy.year(scheduleExpression.getYear());
    scheduleExpressionCopy.month(scheduleExpression.getMonth());
    scheduleExpressionCopy.dayOfMonth(scheduleExpression.getDayOfMonth());
    scheduleExpressionCopy.dayOfWeek(scheduleExpression.getDayOfWeek());
    scheduleExpressionCopy.hour(scheduleExpression.getHour());
    scheduleExpressionCopy.minute(scheduleExpression.getMinute());
    scheduleExpressionCopy.second(scheduleExpression.getSecond());
    scheduleExpressionCopy.start(scheduleExpression.getStart());
    scheduleExpressionCopy.end(scheduleExpression.getEnd());
    scheduleExpressionCopy.timezone(scheduleExpression.getTimezone());

    return scheduleExpressionCopy;
}
 
Example 3
Source File: QuartzPersistenceForEJBTimersTest.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void newTimer() {
    final TimerConfig tc = new TimerConfig("my-timer", true);
    final ScheduleExpression se = new ScheduleExpression();
    final Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.SECOND, 2);
    se.second(calendar.get(Calendar.SECOND) + "/3");
    se.minute("*");
    se.hour("*");
    se.dayOfMonth("*");
    se.dayOfWeek("*");
    se.month("*");
    timer = timerService.createCalendarTimer(se, tc);
}
 
Example 4
Source File: GetTimerTest.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void newTimer() {
    final TimerConfig tc = new TimerConfig("my-timer", true);
    final ScheduleExpression se = new ScheduleExpression();
    final Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.SECOND, 2);
    se.second(calendar.get(Calendar.SECOND) + "/3");
    se.minute("*");
    se.hour("*");
    se.dayOfMonth("*");
    se.dayOfWeek("*");
    se.month("*");
    timer = timerService.createCalendarTimer(se, tc);
}