Search in sources :

Example 1 with Event

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;
}
Also used : Event(org.estatio.module.event.dom.Event) Action(org.apache.isis.applib.annotation.Action)

Example 2 with Event

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;
}
Also used : Event(org.estatio.module.event.dom.Event) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Aggregations

Event (org.estatio.module.event.dom.Event)2 Action (org.apache.isis.applib.annotation.Action)1 ActionLayout (org.apache.isis.applib.annotation.ActionLayout)1