Class CalendarWorkspaceModule
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.workspaces.AbstractWorkspaceModule
-
- org.ametys.plugins.workspaces.calendars.CalendarWorkspaceModule
-
- All Implemented Interfaces:
Comparable<WorkspaceModule>,WorkspaceModule,LogEnabled,PluginAware,Configurable,Contextualizable,Serviceable
public class CalendarWorkspaceModule extends AbstractWorkspaceModule implements Configurable
Helper component for managing calendars
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classCalendarWorkspaceModule.StartDateComparatorCompares events on their starting date
-
Field Summary
Fields Modifier and Type Field Description static StringCALENDAR_MODULE_IDThe id of calendar module-
Fields inherited from class org.ametys.plugins.workspaces.AbstractWorkspaceModule
_context, _currentUserProvider, _i18nUtils, _modulesEP, _observationManager, _pageDAO, _pluginName, _projectManager, _projectRightHelper, _resolver, _rightManager, _serviceEP, _skinsManager, _userHelper, _userManager
-
Fields inherited from interface org.ametys.plugins.workspaces.project.modules.WorkspaceModule
ORDER_ABOUT, ORDER_ALERTS, ORDER_CALENDAR, ORDER_DOCUMENTS, ORDER_MEMBERS, ORDER_MINISITE, ORDER_NEWS, ORDER_TASKS, ORDER_THREADS, ORDER_WALLCONTENT
-
-
Constructor Summary
Constructors Constructor Description CalendarWorkspaceModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_addAdditionalEventData(CalendarEvent event, Map<String,Object> eventData)Add additional information on project and parent calendarprotected void_internalActivateModule(Project project, Map<String,Object> additionalValues)Internal process when module is activatedbooleancanView(Calendar calendar)Indicates if the current user can view the calendarbooleancanView(CalendarEvent event)Indicates if the current user can view the eventvoidconfigure(Configuration configuration)CalendarcreateResourceCalendar(Project project, Map<String,Object> additionalValues)Create a calendar to store resources if neededSet<String>getAllowedEventTypes()Get the set of allowed event type for the moduleModifiableResourceCollectiongetCalendarResourcesRoot(Project project, boolean create)Get the root for tasksAmetysObjectIterable<Calendar>getCalendars(Project project)Get the calendars of a projectModifiableResourceCollectiongetCalendarsRoot(Project project, boolean create)Get the root for tasksStringgetEventUri(Project project, String calendarId, String eventId)Get the URI of a thread in project'siteStringgetId()Get the module Idprotected StringgetLang(Project project)Get the lang for this project, or fr if none foundI18nizableTextgetModuleDescription()Get the module titleStringgetModuleName()Get the module nameprotected StringgetModulePageName()Returns the module page's nameprotected I18nizableTextgetModulePageTitle()Returns the module page's title as i18nModifiableResourceCollectiongetModuleRoot(Project project, boolean create)Get the module root node for the given projectI18nizableTextgetModuleTitle()Get the module titleintgetOrder()Get the module orderCalendargetResourceCalendar(Project project)Get the calendars of a projectModifiableResourceCollectiongetResourceCalendarRoot(Project project, boolean create)Get the root for tasksList<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 rightprotected voidinitializeModulePage(ModifiablePage calendarPage)Initialize the module pagevoidservice(ServiceManager manager)-
Methods inherited from class org.ametys.plugins.workspaces.AbstractWorkspaceModule
_createModulePage, _deleteEvents, _deletePages, _getAmetysObject, _getDefaultXslt, _getModulePages, _internalDeactivateModule, _internalDeleteData, _setPagesVisibility, activateModule, contextualize, deactivateModule, deleteData, getModulePageTemplate, getModuleUrl, initializeSitemap, setPluginInfo
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.plugins.workspaces.project.modules.WorkspaceModule
compareTo, isUnactivatedByDefault
-
-
-
-
Field Detail
-
CALENDAR_MODULE_ID
public static final String CALENDAR_MODULE_ID
The id of calendar module
-
-
Constructor Detail
-
CalendarWorkspaceModule
public CalendarWorkspaceModule()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractWorkspaceModule- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
getId
public String getId()
Description copied from interface:WorkspaceModuleGet the module Id- Specified by:
getIdin interfaceWorkspaceModule- Returns:
- The module ID
-
getOrder
public int getOrder()
Description copied from interface:WorkspaceModuleGet the module order- Specified by:
getOrderin interfaceWorkspaceModule- Returns:
- the priority in menus
-
getModuleName
public String getModuleName()
Description copied from interface:WorkspaceModuleGet the module name- Specified by:
getModuleNamein interfaceWorkspaceModule- Returns:
- the module name
-
getModulePageName
protected String getModulePageName()
Description copied from class:AbstractWorkspaceModuleReturns the module page's name- Specified by:
getModulePageNamein classAbstractWorkspaceModule- Returns:
- The module page's name
-
getModuleTitle
public I18nizableText getModuleTitle()
Description copied from interface:WorkspaceModuleGet the module title- Specified by:
getModuleTitlein interfaceWorkspaceModule- Returns:
- The title
-
getModuleDescription
public I18nizableText getModuleDescription()
Description copied from interface:WorkspaceModuleGet the module title- Specified by:
getModuleDescriptionin interfaceWorkspaceModule- Returns:
- The title
-
getModulePageTitle
protected I18nizableText getModulePageTitle()
Description copied from class:AbstractWorkspaceModuleReturns the module page's title as i18n- Specified by:
getModulePageTitlein classAbstractWorkspaceModule- Returns:
- The module page's title
-
initializeModulePage
protected void initializeModulePage(ModifiablePage calendarPage)
Description copied from class:AbstractWorkspaceModuleInitialize the module page- Specified by:
initializeModulePagein classAbstractWorkspaceModule- Parameters:
calendarPage- The module page
-
getCalendars
public AmetysObjectIterable<Calendar> getCalendars(Project project)
Get the calendars of a project- Parameters:
project- The project- Returns:
- The list of calendar
-
getModuleRoot
public ModifiableResourceCollection getModuleRoot(Project project, boolean create)
Description copied from interface:WorkspaceModuleGet the module root node for the given project- Specified by:
getModuleRootin interfaceWorkspaceModule- Parameters:
project- The project containing the modulecreate- True to create the node if it does not exists- Returns:
- The root node, or null if it does not exists and was not created
-
getEventUri
public String getEventUri(Project project, String calendarId, String eventId)
Get the URI of a thread in project'site- Parameters:
project- The projectcalendarId- The id of calendareventId- The id of event- Returns:
- The thread uri
-
_addAdditionalEventData
protected void _addAdditionalEventData(CalendarEvent event, Map<String,Object> eventData)
Add additional information on project and parent calendar- Parameters:
event- The eventeventData- The event data to complete
-
getUpcomingEvents
public 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- Parameters:
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 tag- Returns:
- the upcoming events
-
canView
public boolean canView(Calendar calendar)
Indicates if the current user can view the calendar- Parameters:
calendar- The calendar to test- Returns:
- true if the calendar can be viewed
-
canView
public boolean canView(CalendarEvent event)
Indicates if the current user can view the event- Parameters:
event- The event to test- Returns:
- true if the event can be viewed
-
getAllowedEventTypes
public Set<String> getAllowedEventTypes()
Description copied from interface:WorkspaceModuleGet the set of allowed event type for the module- Specified by:
getAllowedEventTypesin interfaceWorkspaceModule- Returns:
- The set of allowed event types
-
_internalActivateModule
protected void _internalActivateModule(Project project, Map<String,Object> additionalValues)
Description copied from class:AbstractWorkspaceModuleInternal process when module is activated- Overrides:
_internalActivateModulein classAbstractWorkspaceModule- Parameters:
project- The projectadditionalValues- A list of optional additional values. Accepted values are : description, mailingList, inscriptionStatus, defaultProfile, tags, categoryTags, keywords and language
-
createResourceCalendar
public Calendar createResourceCalendar(Project project, Map<String,Object> additionalValues)
Create a calendar to store resources if needed- Parameters:
project- the projectadditionalValues- A list of optional additional values. Accepted values are : description, mailingList, inscriptionStatus, defaultProfile, tags, categoryTags, keywords and language- Returns:
- The resource calendar
-
getLang
protected String getLang(Project project)
Get the lang for this project, or fr if none found- Parameters:
project- the project to check- Returns:
- a lang in this project
-
getResourceCalendar
public Calendar getResourceCalendar(Project project)
Get the calendars of a project- Parameters:
project- The project- Returns:
- The list of calendar
-
getCalendarResourcesRoot
public ModifiableResourceCollection getCalendarResourcesRoot(Project project, boolean create)
Get the root for tasks- Parameters:
project- The projectcreate- true to create root if not exists- Returns:
- The root for tasks
-
getCalendarsRoot
public ModifiableResourceCollection getCalendarsRoot(Project project, boolean create)
Get the root for tasks- Parameters:
project- The projectcreate- true to create root if not exists- Returns:
- The root for tasks
-
getResourceCalendarRoot
public ModifiableResourceCollection getResourceCalendarRoot(Project project, boolean create)
Get the root for tasks- Parameters:
project- The projectcreate- true to create root if not exists- Returns:
- The root for tasks
-
-