Class AgendaCalendarLinkCleanupListener

java.lang.Object
org.exoplatform.agenda.listener.AgendaCalendarLinkCleanupListener
All Implemented Interfaces:
org.exoplatform.services.listener.ListenerBase<org.exoplatform.agenda.model.Calendar,Object>

@Component public class AgendaCalendarLinkCleanupListener extends Object implements org.exoplatform.services.listener.ListenerBase<org.exoplatform.agenda.model.Calendar,Object>
Deletes the link of a calendar once the calendar is deleted. Glue only: the deletion is the service's.

The link table carries no foreign key to the calendar table on purpose: a key would make every deletion of a calendar that has a link fail, whichever addon deletes it. A link left behind would open nothing anyway — the feed answers 404 for a calendar that no longer exists — so this listener keeps the table tidy rather than keeping anything safe.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Broadcast by AgendaCalendarStorage once a calendar row is deleted.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AgendaCalendarLinkCleanupListener(org.exoplatform.services.listener.ListenerService listenerService, org.exoplatform.agenda.service.AgendaCalendarLinkService calendarLinkService)
    Builds the listener.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Registers the listener on the calendar deletion event.
    void
    onEvent(org.exoplatform.services.listener.Event<org.exoplatform.agenda.model.Calendar,Object> event)
    Deletes the link of the deleted calendar.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.exoplatform.services.listener.ListenerBase

    getName
  • Field Details

    • CALENDAR_DELETED_EVENT

      public static final String CALENDAR_DELETED_EVENT
      Broadcast by AgendaCalendarStorage once a calendar row is deleted.
      See Also:
  • Constructor Details

    • AgendaCalendarLinkCleanupListener

      @Autowired public AgendaCalendarLinkCleanupListener(org.exoplatform.services.listener.ListenerService listenerService, org.exoplatform.agenda.service.AgendaCalendarLinkService calendarLinkService)
      Builds the listener.
      Parameters:
      listenerService - the platform event bus
      calendarLinkService - the owner of calendar links
  • Method Details

    • init

      @PostConstruct public void init()
      Registers the listener on the calendar deletion event.
    • onEvent

      public void onEvent(org.exoplatform.services.listener.Event<org.exoplatform.agenda.model.Calendar,Object> event)
      Deletes the link of the deleted calendar.
      Specified by:
      onEvent in interface org.exoplatform.services.listener.ListenerBase<org.exoplatform.agenda.model.Calendar,Object>
      Parameters:
      event - the deletion event, whose source is the deleted calendar