Package org.xwiki.contrib.moccacalendar
Interface EventSource
-
@Role @Unstable public interface EventSource- Since:
- 2.11
- Version:
- $Id: $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default org.xwiki.model.reference.LocalDocumentReferencegetConfigurationClass()The configuration class to use for this event source.EventInstancegetEventInstance(com.xpn.xwiki.api.Document eventDoc, Date eventStartDate)Return the given document as anEventInstancewith the given start date.List<EventInstance>getEvents(Date dateFrom, Date dateTo, String filter, org.xwiki.model.reference.DocumentReference parentRef, boolean sortAscending)Get all events that this source can find for the given constraints.default booleanisAvailable()Check if the source is available in the given context.
-
-
-
Method Detail
-
isAvailable
default boolean isAvailable()
Check if the source is available in the given context. To get the context, use a context provider.- Returns:
- true if the source is available to create events
-
getEvents
List<EventInstance> getEvents(Date dateFrom, Date dateTo, String filter, org.xwiki.model.reference.DocumentReference parentRef, boolean sortAscending)
Get all events that this source can find for the given constraints. If the "dateTo" is null, then assume a search for all events where the "dateFrom" is between the start date and the end date of the event. Otherwise return all events where the time interval between start date and end date (both inclusive) overlaps with the (inclusive) interval of dateFrom to dateTo. It can be assumed that dateTo is equal or after dateFrom, otherwise return an empty list. The filter parameter is a hint how to limit the the results relative to the given "parentRef" document. If the filter is null or equals to "wiki", all events independent of their location should be returned. The "parentRef" parameter can be ignored in that case. If the filter is "page", then return only direct sub pages of the given parentRef. If the filter is "space", then return all events whose pages are nested within the parentRefs space (i.e. they would also show up in that pages "Children" or "Siblings" view. If the filter is unknown or not supported, then return an empty list.- Parameters:
dateFrom- the start date of the date search window, never nulldateTo- the end date of the date search window, might be nullfilter- textual hint how to filter the events, might be nullparentRef- the root document for the filter. might be nullsortAscending- if the events should be sorted by start date- Returns:
- a list of event instances, should not be null, and should not contain nulls.
- See Also:
MoccaCalendarScriptService.queryEvents(Date, Date, String, String, boolean)
-
getEventInstance
EventInstance getEventInstance(com.xpn.xwiki.api.Document eventDoc, Date eventStartDate)
Return the given document as anEventInstancewith the given start date. If the document contains only information about one event, then the start date can be ignored. If there is no matching information that this source can create from the document, then return null.- Parameters:
eventDoc- the document storing the information about this eventeventStartDate- the start date of the event, might be null if it does not matter- Returns:
- an event instance or null, if not event data found
-
getConfigurationClass
default org.xwiki.model.reference.LocalDocumentReference getConfigurationClass()
The configuration class to use for this event source. The configuration source allows to enable or disable the source for different calendars. It might also add more variables to configure the event source; if these should be used then the event source is responsible to get an instance of that configuration class from the current document. The default implementation returnsnullwhich means no special configuration class. In that case a default class will be used.- Returns:
- a class name, or null. In the latter case a default implementation will be used.
- See Also:
DefaultSourceConfigurationClassInitializer
-
-