use of org.estatio.module.event.dom.Event in project estatio by estatio.
the class BreakOption method remove.
// //////////////////////////////////////
@Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
public void remove(final String reason) {
for (Event event : findEvents()) {
eventRepository.remove(event);
}
getContainer().remove(this);
getContainer().flush();
return;
}
use of org.estatio.module.event.dom.Event in project estatio by estatio.
the class FixedBreakOption method updateReminderDate.
// //////////////////////////////////////
/**
* Creates/updates/deletes a corresponding {@link Event} with a
* {@link Event#getCalendarName() calendar name} of
* {@link #CALENDAR_NAME_FIXED_BREAK_EXERCISE_REMINDER}.
*/
@ActionLayout(named = "Update")
public FixedBreakOption updateReminderDate(@Parameter(optionality = Optionality.OPTIONAL) @ParameterLayout(named = CALENDAR_NAME_FIXED_BREAK_EXERCISE_REMINDER, describedAs = "Reminder to exercise (or leave blank to clear)") final LocalDate reminderDate) {
setReminderDate(reminderDate);
final Event reminderEvent = eventRepository.findBySourceAndCalendarName(this, CALENDAR_NAME_FIXED_BREAK_EXERCISE_REMINDER);
if (reminderDate != null) {
if (reminderEvent == null) {
// create...
createEvent(getReminderDate(), this, CALENDAR_NAME_FIXED_BREAK_EXERCISE_REMINDER);
} else {
// update...
reminderEvent.setDate(reminderDate);
}
} else {
if (reminderEvent != null) {
// delete...
removeIfNotAlready(reminderEvent);
}
}
return this;
}
Aggregations