public class CalendarWorkspaceModule extends AbstractWorkspaceModule
Modifier and Type | Class and Description |
---|---|
protected static class |
CalendarWorkspaceModule.StartDateComparator
Compares events on their starting date
|
Modifier and Type | Field and Description |
---|---|
private static String |
__CALENDAR_CACHE_REQUEST_ATTR |
private static String |
__CALENDAR_MODULE_TAG
Tag on the main page holding the calendar module
|
private static String |
__MODULE_TITLE_KEY
Module i18n title key
|
private static String |
__WORKSPACES_CALENDARS_NODE_NAME
Workspaces calendars node name
|
private WorkspaceCalendarDAO |
_calendarDAO |
static String |
CALENDAR_MODULE_ID
The id of calendar module
|
_context, _currentUserProvider, _i18nUtils, _observationManager, _pageDAO, _pluginName, _projectManager, _projectRightHelper, _resolver, _rightManager, _serviceEP, _skinsManager, _userHelper, _userManager
Constructor and Description |
---|
CalendarWorkspaceModule() |
Modifier and Type | Method and Description |
---|---|
protected void |
_addAdditionalEventData(CalendarEvent event,
Map<String,Object> eventData)
Add additional information on project and parent calendar
|
private boolean |
_filterEvent(List<String> calendarIds,
CalendarEvent event)
Determine whether the given event has to be kept or not depending on the given calendars
|
protected <A extends AmetysObject> |
_getAmetysObject(ModifiableTraversableAmetysObject parent,
String name,
String type,
boolean create)
Utility method to get or create an ametys object
|
private boolean |
_hasAccess(Calendar calendar) |
Map<String,Object> |
addCalendar(String inputName,
String description,
String templateDesc,
String color,
String visibility,
String workflowName,
Boolean renameIfExists)
Add a calendar
|
boolean |
canView(Calendar calendar)
Indicates if the current user can view the calendar
|
boolean |
canView(CalendarEvent event)
Indicates if the current user can view the event
|
Set<String> |
getAllowedEventTypes()
Get the set of allowed event type for the module
|
AmetysObjectIterable<Calendar> |
getCalendars(Project project)
Get the calendars of a project
|
List<Map<String,Object>> |
getCalendarsData()
Get the data of every available calendar of the application
|
Map<String,Object> |
getCalendarServiceRights(List<String> calendarIds)
Get the rights of the current user for the calendar service
|
String |
getEventUri(Project project,
String calendarId,
String eventId,
String language)
Get the URI of a thread in project'site
|
String |
getId()
Get the module Id
|
Map<String,Object> |
getModuleBaseRights()
Retrieves the set of general rights used in the calendar module for the current user
|
protected String |
getModulePageName()
Returns the module page's name
|
protected I18nizableText |
getModulePageTitle()
Returns the module page's title as i18n
|
ModifiableResourceCollection |
getModuleRoot(Project project,
boolean create)
Get the module root node for the given project
|
protected String |
getModuleTagName()
Returns the tag of apply to module page
|
I18nizableText |
getModuleTitle()
Get the module title
|
List<Map<String,Object>> |
getUpcomingEvents(int months,
int maxResults,
List<String> calendarIds,
List<String> tagIds)
Get the upcoming events of the calendars on which the user has a right
|
List<Map<String,Object>> |
getUpcomingEvents(String months,
String maxResults,
List<String> calendarIds,
List<String> tagIds)
Get the upcoming events of the calendars on which the user has a right
|
protected void |
initializeModulePage(ModifiablePage calendarPage)
Initialize the module page
|
void |
service(ServiceManager manager) |
_createModulePage, _deletePages, _getDefaultXslt, _internalActivateModule, _internalDeactivateModule, activateModule, contextualize, deactivateModule, getModulePages, getModulePageTemplate, initializeSitemap, setPluginInfo
getLogger, setLogger
public static final String CALENDAR_MODULE_ID
private static final String __CALENDAR_MODULE_TAG
private static final String __WORKSPACES_CALENDARS_NODE_NAME
private static final String __CALENDAR_CACHE_REQUEST_ATTR
private static final String __MODULE_TITLE_KEY
private WorkspaceCalendarDAO _calendarDAO
public CalendarWorkspaceModule()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
service
in class AbstractWorkspaceModule
ServiceException
public String getId()
WorkspaceModule
public I18nizableText getModuleTitle()
WorkspaceModule
protected String getModulePageName()
AbstractWorkspaceModule
getModulePageName
in class AbstractWorkspaceModule
protected I18nizableText getModulePageTitle()
AbstractWorkspaceModule
getModulePageTitle
in class AbstractWorkspaceModule
protected String getModuleTagName()
AbstractWorkspaceModule
getModuleTagName
in class AbstractWorkspaceModule
protected void initializeModulePage(ModifiablePage calendarPage)
AbstractWorkspaceModule
initializeModulePage
in class AbstractWorkspaceModule
calendarPage
- The module pagepublic AmetysObjectIterable<Calendar> getCalendars(Project project)
project
- The projectpublic ModifiableResourceCollection getModuleRoot(Project project, boolean create)
WorkspaceModule
project
- The project containing the modulecreate
- True to create the node if it does not existsprotected <A extends AmetysObject> A _getAmetysObject(ModifiableTraversableAmetysObject parent, String name, String type, boolean create) throws AmetysRepositoryException
A
- A sub class of AmetysObjectparent
- The parent objectname
- The ametys object nametype
- The ametys object typecreate
- True to create the object if it does not existAmetysRepositoryException
- if an repository error occurspublic Map<String,Object> getModuleBaseRights()
public Map<String,Object> getCalendarServiceRights(List<String> calendarIds)
calendarIds
- The list of calendarspublic String getEventUri(Project project, String calendarId, String eventId, String language)
project
- The projectcalendarId
- The id of calendareventId
- The id of eventlanguage
- The sitemap languagepublic Map<String,Object> addCalendar(String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists) throws IllegalAccessException
inputName
- The desired name for the calendardescription
- The calendar descriptiontemplateDesc
- The calendar template descriptioncolor
- The calendar colorvisibility
- The calendar visibilityworkflowName
- The calendar workflow namerenameIfExists
- True to rename if existingIllegalAccessException
- If the user has no sufficient rightsprotected void _addAdditionalEventData(CalendarEvent event, Map<String,Object> eventData)
event
- The eventeventData
- The event data to completepublic List<Map<String,Object>> getUpcomingEvents(String months, String maxResults, List<String> calendarIds, List<String> tagIds)
months
- the amount of months from today in which look for upcoming eventsmaxResults
- the maximum results to displaycalendarIds
- the ids of the calendars to gather events from, null for all calendarstagIds
- the ids of the valid tags for the events, null for any tagpublic List<Map<String,Object>> getUpcomingEvents(int months, int maxResults, List<String> calendarIds, List<String> tagIds)
months
- the amount of months from today in which look for upcoming eventsmaxResults
- the maximum results to displaycalendarIds
- the ids of the calendars to gather events from, null for all calendarstagIds
- the ids of the valid tags for the events, null for any tagprivate boolean _filterEvent(List<String> calendarIds, CalendarEvent event)
calendarIds
- the ids of the calendarsevent
- the eventprivate boolean _hasAccess(Calendar calendar)
public List<Map<String,Object>> getCalendarsData()
public boolean canView(Calendar calendar)
calendar
- The calendar to testpublic boolean canView(CalendarEvent event)
event
- The event to testpublic Set<String> getAllowedEventTypes()
WorkspaceModule