Class CalendarDAO
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.workspaces.calendars.AbstractCalendarDAO
org.ametys.plugins.workspaces.calendars.CalendarDAO
- All Implemented Interfaces:
Component
,Contextualizable
,LogEnabled
,Serviceable
Calendar DAO
-
Field Summary
Modifier and TypeFieldDescriptionprotected CalendarEventJSONHelper
The tasks list JSON helperstatic final String
Avalon RoleFields inherited from class org.ametys.plugins.workspaces.calendars.AbstractCalendarDAO
_calendarColors, _context, _currentUserProvider, _explorerResourcesDAO, _messagingConnectorCalendarManager, _observationManager, _projectManager, _projectTagsDAO, _resolver, _rightManager, _userManager, _workflowHelper, _workflowProvider, _workspaceModuleEP, RIGHTS_BOOK_RESOURCE, RIGHTS_CALENDAR_ADD, RIGHTS_CALENDAR_DELETE, RIGHTS_CALENDAR_EDIT, RIGHTS_EVENT_ADD, RIGHTS_EVENT_DELETE, RIGHTS_EVENT_DELETE_OWN, RIGHTS_EVENT_EDIT, RIGHTS_HANDLE_RESOURCE, RIGHTS_OWNED_EVENT_DELETE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_extractCalendarRightData
(Calendar calendar) Internal method to extract the data concerning the right of the current user for a calendarprotected ModifiableTraversableAmetysObject
Get the calendar rootaddCalendar
(String inputName, String color, boolean isPublic) Add a calendaraddCalendar
(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists) Add a calendaraddCalendar
(ModifiableTraversableAmetysObject parent, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists, Boolean checkRights, boolean notify) Add a calendardeleteCalendar
(String id) Delete a calendareditCalendar
(String id, String inputName, String templateDesc, String color, boolean isPublic) Edit a calendargetCalendarData
(Calendar calendar, boolean recursive, boolean includeEvents, boolean useICSFormat) Get calendar infogetCalendarFromIcsToken
(String token) Retrieve the calendar for the matching ICS tokengetCalendarIcsToken
(Calendar calendar, boolean createIfNotExisting) Get or create the calendar ICS tokengetCalendarProperties
(Calendar calendar) Get calendar infoGet the data of every available calendar for the current projectGet the colors of calendarsGet the data of calendar used to store resourcesGet user rights from project namevoid
service
(ServiceManager manager) Methods inherited from class org.ametys.plugins.workspaces.calendars.AbstractCalendarDAO
_getProject, _getProjectName, contextualize
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
Avalon Role -
_calendarEventJSONHelper
The tasks list JSON helper
-
-
Constructor Details
-
CalendarDAO
public CalendarDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractCalendarDAO
- Throws:
ServiceException
-
getCalendarData
public Map<String,Object> getCalendarData(Calendar calendar, boolean recursive, boolean includeEvents, boolean useICSFormat) Get calendar info- Parameters:
calendar
- The calendarrecursive
- True to get data for sub calendarsincludeEvents
- True to also include child eventsuseICSFormat
- true to use ICS Format for dates- Returns:
- the calendar data in a map
-
getCalendarProperties
Get calendar info- Parameters:
calendar
- The calendar- Returns:
- the calendar data in a map
-
addCalendar
public Map<String,Object> addCalendar(String inputName, String color, boolean isPublic) throws IllegalAccessException Add a calendar- Parameters:
inputName
- The desired name for the calendarcolor
- The calendar colorisPublic
- true if the calendar is public- Returns:
- The result map with id, parentId and name keys
- Throws:
IllegalAccessException
- If the user has no sufficient rights
-
addCalendar
public Map<String,Object> addCalendar(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists) throws IllegalAccessException Add a calendar- Parameters:
id
- The identifier of the parent in which the calendar will be addedinputName
- 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 existing- Returns:
- The result map with id, parentId and name keys
- Throws:
IllegalAccessException
- If the user has no sufficient rights
-
addCalendar
public Map<String,Object> addCalendar(ModifiableTraversableAmetysObject parent, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists, Boolean checkRights, boolean notify) throws IllegalAccessException Add a calendar- Parameters:
parent
- The parent in which the calendar will be addedinputName
- 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 existingcheckRights
- true to check if the current user have enough rights to create the calendarnotify
- True to notify the calendar creation- Returns:
- The result map with id, parentId and name keys
- Throws:
IllegalAccessException
- If the user has no sufficient rights
-
editCalendar
public Map<String,Object> editCalendar(String id, String inputName, String templateDesc, String color, boolean isPublic) throws IllegalAccessException Edit a calendar- Parameters:
id
- The identifier of the calendarinputName
- The new nametemplateDesc
- The new calendar template descriptioncolor
- The calendar colorisPublic
- true if the calendar is public- Returns:
- The result map with id and name keys
- Throws:
IllegalAccessException
- If the user has no sufficient rights
-
deleteCalendar
Delete a calendar- Parameters:
id
- The id of the calendar- Returns:
- The result map with id, parent id and message keys
- Throws:
IllegalAccessException
- If the user has no sufficient rights
-
getCalendarIcsToken
Get or create the calendar ICS token- Parameters:
calendar
- The calendarcreateIfNotExisting
- Create the token if none exists for the given calendar- Returns:
- The token
-
getCalendarFromIcsToken
Retrieve the calendar for the matching ICS token- Parameters:
token
- The ICS token- Returns:
- The calendar, or null if not found
-
_extractCalendarRightData
Internal method to extract the data concerning the right of the current user for a calendar- Parameters:
calendar
- The calendar- Returns:
- The map of right data. Keys are the rights id, and values indicates whether the current user has the right or not.
-
getCalendars
Get the data of every available calendar for the current project- Returns:
- the list of calendars
-
getColors
Get the colors of calendars- Returns:
- colors
-
getUserRights
Get user rights from project name- Returns:
- the user rights
-
_getCalendarRoot
Get the calendar root- Returns:
- the calendar root
-
getResourceCalendar
Get the data of calendar used to store resources- Returns:
- the calendar used to store resources
-