public ScheduledEventRT createRuntime() {
return new ScheduledEventRT(this);
}
public TranslatableMessage getDescription() {
TranslatableMessage message;
if (!StringUtils.isBlank(alias))
message = new TranslatableMessage("common.default", alias);
else if (scheduleType == TYPE_ONCE) {
if (returnToNormal)
message = new TranslatableMessage("event.schedule.onceUntil", Functions.getTime(new DateTime(
activeYear, activeMonth, activeDay, activeHour, activeMinute, activeSecond, 0).getMillis()),
Functions.getTime(new DateTime(inactiveYear, inactiveMonth, inactiveDay, inactiveHour,
inactiveMinute, inactiveSecond, 0).getMillis()));
else
message = new TranslatableMessage("event.schedule.onceAt", Functions.getTime(new DateTime(activeYear,
activeMonth, activeDay, activeHour, activeMinute, activeSecond, 0).getMillis()));
}
else if (scheduleType == TYPE_HOURLY) {
String activeTime = StringUtils.leftPad(Integer.toString(activeMinute), 2, '0') + ":"
+ StringUtils.leftPad(Integer.toString(activeSecond), 2, '0');
if (returnToNormal)
message = new TranslatableMessage("event.schedule.hoursUntil", activeTime, StringUtils.leftPad(
Integer.toString(inactiveMinute), 2, '0')
+ ":" + StringUtils.leftPad(Integer.toString(inactiveSecond), 2, '0'));
else
message = new TranslatableMessage("event.schedule.hoursAt", activeTime);
}
else if (scheduleType == TYPE_DAILY) {
if (returnToNormal)
message = new TranslatableMessage("event.schedule.dailyUntil", activeTime(), inactiveTime());
else
message = new TranslatableMessage("event.schedule.dailyAt", activeTime());
}
else if (scheduleType == TYPE_WEEKLY) {
if (returnToNormal)
message = new TranslatableMessage("event.schedule.weeklyUntil", weekday(true), activeTime(),
weekday(false), inactiveTime());
else
message = new TranslatableMessage("event.schedule.weeklyAt", weekday(true), activeTime());
}
else if (scheduleType == TYPE_MONTHLY) {
if (returnToNormal)
message = new TranslatableMessage("event.schedule.monthlyUntil", monthday(true), activeTime(),
monthday(false), inactiveTime());
else
message = new TranslatableMessage("event.schedule.monthlyAt", monthday(true), activeTime());
}
else if (scheduleType == TYPE_YEARLY) {
if (returnToNormal)
message = new TranslatableMessage("event.schedule.yearlyUntil", monthday(true), month(true),
activeTime(), monthday(false), month(false), inactiveTime());
else
message = new TranslatableMessage("event.schedule.yearlyAt", monthday(true), month(true), activeTime());
}
else if (scheduleType == TYPE_CRON) {
if (returnToNormal)
message = new TranslatableMessage("event.schedule.cronUntil", activeCron, inactiveCron);
else
message = new TranslatableMessage("event.schedule.cronAt", activeCron);
}
else
throw new ShouldNeverHappenException("Unknown schedule type: " + scheduleType);
return message;