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 class
CalendarWorkspaceModule.StartDateComparator
Compares events on their starting date
-
Field Summary
Fields Modifier and Type Field Description static String
CALENDAR_MODULE_ID
The 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 activatedboolean
canView(Calendar calendar)
Indicates if the current user can view the calendarboolean
canView(CalendarEvent event)
Indicates if the current user can view the eventvoid
configure(Configuration configuration)
Calendar
createResourceCalendar(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 moduleModifiableResourceCollection
getCalendarResourcesRoot(Project project, boolean create)
Get the root for tasksAmetysObjectIterable<Calendar>
getCalendars(Project project)
Get the calendars of a projectModifiableResourceCollection
getCalendarsRoot(Project project, boolean create)
Get the root for tasksString
getEventUri(Project project, String calendarId, String eventId)
Get the URI of a thread in project'siteString
getId()
Get the module Idprotected String
getLang(Project project)
Get the lang for this project, or fr if none foundI18nizableText
getModuleDescription()
Get the module titleString
getModuleName()
Get the module nameprotected String
getModulePageName()
Returns the module page's nameprotected I18nizableText
getModulePageTitle()
Returns the module page's title as i18nModifiableResourceCollection
getModuleRoot(Project project, boolean create)
Get the module root node for the given projectI18nizableText
getModuleTitle()
Get the module titleint
getOrder()
Get the module orderCalendar
getResourceCalendar(Project project)
Get the calendars of a projectModifiableResourceCollection
getResourceCalendarRoot(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 void
initializeModulePage(ModifiablePage calendarPage)
Initialize the module pagevoid
service(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:
service
in interfaceServiceable
- Overrides:
service
in classAbstractWorkspaceModule
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
getId
public String getId()
Description copied from interface:WorkspaceModule
Get the module Id- Specified by:
getId
in interfaceWorkspaceModule
- Returns:
- The module ID
-
getOrder
public int getOrder()
Description copied from interface:WorkspaceModule
Get the module order- Specified by:
getOrder
in interfaceWorkspaceModule
- Returns:
- the priority in menus
-
getModuleName
public String getModuleName()
Description copied from interface:WorkspaceModule
Get the module name- Specified by:
getModuleName
in interfaceWorkspaceModule
- Returns:
- the module name
-
getModulePageName
protected String getModulePageName()
Description copied from class:AbstractWorkspaceModule
Returns the module page's name- Specified by:
getModulePageName
in classAbstractWorkspaceModule
- Returns:
- The module page's name
-
getModuleTitle
public I18nizableText getModuleTitle()
Description copied from interface:WorkspaceModule
Get the module title- Specified by:
getModuleTitle
in interfaceWorkspaceModule
- Returns:
- The title
-
getModuleDescription
public I18nizableText getModuleDescription()
Description copied from interface:WorkspaceModule
Get the module title- Specified by:
getModuleDescription
in interfaceWorkspaceModule
- Returns:
- The title
-
getModulePageTitle
protected I18nizableText getModulePageTitle()
Description copied from class:AbstractWorkspaceModule
Returns the module page's title as i18n- Specified by:
getModulePageTitle
in classAbstractWorkspaceModule
- Returns:
- The module page's title
-
initializeModulePage
protected void initializeModulePage(ModifiablePage calendarPage)
Description copied from class:AbstractWorkspaceModule
Initialize the module page- Specified by:
initializeModulePage
in 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:WorkspaceModule
Get the module root node for the given project- Specified by:
getModuleRoot
in 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:WorkspaceModule
Get the set of allowed event type for the module- Specified by:
getAllowedEventTypes
in interfaceWorkspaceModule
- Returns:
- The set of allowed event types
-
_internalActivateModule
protected void _internalActivateModule(Project project, Map<String,Object> additionalValues)
Description copied from class:AbstractWorkspaceModule
Internal process when module is activated- Overrides:
_internalActivateModule
in 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
-
-