use of org.apache.openejb.assembler.classic.MethodScheduleInfo in project tomee by apache.
the class EjbJarInfoBuilder method copySchedules.
private void copySchedules(final List<Timer> timers, final List<MethodScheduleInfo> scheduleInfos) {
final Map<NamedMethod, MethodScheduleInfo> methodScheduleInfoMap = new HashMap<>();
for (final Timer timer : timers) {
final NamedMethod timeoutMethod = timer.getTimeoutMethod();
MethodScheduleInfo methodScheduleInfo = methodScheduleInfoMap.get(timer.getTimeoutMethod());
if (methodScheduleInfo == null) {
methodScheduleInfo = new MethodScheduleInfo();
methodScheduleInfoMap.put(timeoutMethod, methodScheduleInfo);
methodScheduleInfo.method = toInfo(timeoutMethod);
}
final ScheduleInfo scheduleInfo = new ScheduleInfo();
// Copy TimerSchedule
final TimerSchedule timerSchedule = timer.getSchedule();
if (timerSchedule != null) {
scheduleInfo.second = timerSchedule.getSecond();
scheduleInfo.minute = timerSchedule.getMinute();
scheduleInfo.hour = timerSchedule.getHour();
scheduleInfo.dayOfWeek = timerSchedule.getDayOfWeek();
scheduleInfo.dayOfMonth = timerSchedule.getDayOfMonth();
scheduleInfo.month = timerSchedule.getMonth();
scheduleInfo.year = timerSchedule.getYear();
}
// Copy other attributes
scheduleInfo.timezone = timer.getTimezone();
if (timer.getStart() != null) {
scheduleInfo.start = timer.getStart().toGregorianCalendar().getTime();
}
if (timer.getEnd() != null) {
scheduleInfo.end = timer.getEnd().toGregorianCalendar().getTime();
}
scheduleInfo.info = timer.getInfo();
if (timer.getPersistent() != null) {
scheduleInfo.persistent = timer.getPersistent();
}
methodScheduleInfo.schedules.add(scheduleInfo);
}
scheduleInfos.addAll(methodScheduleInfoMap.values());
}
Aggregations