use of org.jboss.metadata.common.ejb.IScheduleTarget in project wildfly by wildfly.
the class TimerMethodMergingProcessor method parseScheduleMethods.
private void parseScheduleMethods(final EnterpriseBeanMetaData beanMetaData, final EJBComponentDescription sessionBean, final Class<?> componentClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException {
if (beanMetaData instanceof IScheduleTarget) {
IScheduleTarget md = (IScheduleTarget) beanMetaData;
if (md.getTimers() != null) {
for (final TimerMetaData timer : md.getTimers()) {
AutoTimer autoTimer = new AutoTimer();
autoTimer.getTimerConfig().setInfo(timer.getInfo());
autoTimer.getTimerConfig().setPersistent(timer.isPersistent());
final ScheduleExpression scheduleExpression = autoTimer.getScheduleExpression();
final ScheduleMetaData schedule = timer.getSchedule();
if (schedule != null) {
scheduleExpression.dayOfMonth(schedule.getDayOfMonth());
scheduleExpression.dayOfWeek(schedule.getDayOfWeek());
scheduleExpression.hour(schedule.getHour());
scheduleExpression.minute(schedule.getMinute());
scheduleExpression.month(schedule.getMonth());
scheduleExpression.second(schedule.getSecond());
scheduleExpression.year(schedule.getYear());
}
if (timer.getEnd() != null) {
scheduleExpression.end(timer.getEnd().getTime());
}
if (timer.getStart() != null) {
scheduleExpression.start(timer.getStart().getTime());
}
scheduleExpression.timezone(timer.getTimezone());
sessionBean.addScheduleMethod(MethodResolutionUtils.resolveMethod(timer.getTimeoutMethod(), componentClass, deploymentReflectionIndex), autoTimer);
}
}
}
}
Aggregations