EN · DE · RU · FR · ES

#2781: EventManager.java

projectforge-wicket/src/main/java/net/ftlines/wicket/fullcalendar/EventManager.java Java Service (FullCalendar Event Lookup) · projectforge-wicket/src/main/java/net/ftlines/wicket/fullcalendar/EventManager.java 60 lines · 19 code · 33 comments · 8 blank
A lookup service that resolves FullCalendar events and event sources by their identifiers. When the FullCalendar client sends an Ajax callback with an event ID and source ID (e.g., a user clicked or dragged an event), the server-side handler uses this manager to locate the corresponding Event and EventSource objects. The lookup traverses the calendar's configured event sources (comparing UUIDs via Objects.equal) and delegates to each source's EventProvider to find the specific event. Throws typed exceptions (EventSourceNotFoundException, EventNotFoundException) for unmatched IDs.

Architecture

Lookup Chain

Two-step resolution: getEventSource(String id) iterates the calendar's event sources (from Config.getEventSources()) comparing each source's UUID using Objects.equal — Wicket's null-safe equality helper. On match, returns the source; on no match, throws EventSourceNotFoundException. getEvent(String sourceId, String eventId) first resolves the source, then calls source.getEventProvider().getEventForId(eventId) — delegating event lookup to the source's provider (typically a DAO-backed implementation). If the provider can't find the event, it throws EventNotFoundException.

Package-Private Constructor

The constructor is package-private — only FullCalendar can create an EventManager (via getEventManager()). This ensures the manager is always associated with a specific calendar instance and its configuration.

Usage in Callbacks

This manager is the bridge between Ajax callback parameters (which carry string IDs) and the Java domain objects. For example, when handling an event drop callback, the handler calls getEventManager().getEvent(sourceId, eventId) to retrieve the affected event object, update its times in the database, and return a response to the client.

Git History

CommitWhat changed
868d6abb7 through ceb63e8a1Six annual copyright header updates. The lookup logic has been stable — the two-step ID→Source→Event resolution pattern covers all callback scenarios, and no additional lookup methods have been needed.