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
public class CalendarDAO extends AbstractCalendarDAO
Calendar DAO
-
-
Field Summary
Fields Modifier and Type Field Description protected CalendarEventJSONHelper
_calendarEventJSONHelper
The tasks list JSON helperstatic String
ROLE
Avalon Role-
Fields 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
Constructors Constructor Description CalendarDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>
_extractCalendarRightData(Calendar calendar)
Internal method to extract the data concerning the right of the current user for a calendarprotected ModifiableTraversableAmetysObject
_getCalendarRoot()
Get the calendar rootMap<String,Object>
addCalendar(String inputName, String color, boolean isPublic)
Add a calendarMap<String,Object>
addCalendar(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists)
Add a calendarMap<String,Object>
addCalendar(ModifiableTraversableAmetysObject parent, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists, Boolean checkRights, boolean notify)
Add a calendarMap<String,Object>
deleteCalendar(String id)
Delete a calendarMap<String,Object>
editCalendar(String id, String inputName, String templateDesc, String color, boolean isPublic)
Edit a calendarMap<String,Object>
getCalendarData(Calendar calendar, boolean recursive, boolean includeEvents)
Get calendar infoCalendar
getCalendarFromIcsToken(String token)
Retrieve the calendar for the matching ICS tokenString
getCalendarIcsToken(Calendar calendar, boolean createIfNotExisting)
Get or create the calendar ICS tokenList<Map<String,Object>>
getCalendars()
Get the data of every available calendar for the current projectMap<String,CalendarColorsComponent.CalendarColor>
getColors()
Get the colors of calendarsMap<String,Object>
getResourceCalendar()
Get the data of calendar used to store resourcesMap<String,Object>
getUserRights()
Get 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 Detail
-
_calendarEventJSONHelper
protected CalendarEventJSONHelper _calendarEventJSONHelper
The tasks list JSON helper
-
-
Constructor Detail
-
CalendarDAO
public CalendarDAO()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractCalendarDAO
- Throws:
ServiceException
-
getCalendarData
public Map<String,Object> getCalendarData(Calendar calendar, boolean recursive, boolean includeEvents)
Get calendar info- Parameters:
calendar
- The calendarrecursive
- True to get data for sub calendarsincludeEvents
- True to also include child events- 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
public Map<String,Object> deleteCalendar(String id) throws IllegalAccessException
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
public String getCalendarIcsToken(Calendar calendar, boolean createIfNotExisting)
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
public Calendar getCalendarFromIcsToken(String token)
Retrieve the calendar for the matching ICS token- Parameters:
token
- The ICS token- Returns:
- The calendar, or null if not found
-
_extractCalendarRightData
protected Map<String,Object> _extractCalendarRightData(Calendar calendar)
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
public List<Map<String,Object>> getCalendars()
Get the data of every available calendar for the current project- Returns:
- the list of calendars
-
getColors
public Map<String,CalendarColorsComponent.CalendarColor> getColors()
Get the colors of calendars- Returns:
- colors
-
getUserRights
public Map<String,Object> getUserRights()
Get user rights from project name- Returns:
- the user rights
-
_getCalendarRoot
protected ModifiableTraversableAmetysObject _getCalendarRoot()
Get the calendar root- Returns:
- the calendar root
-
getResourceCalendar
public Map<String,Object> getResourceCalendar()
Get the data of calendar used to store resources- Returns:
- the calendar used to store resources
-
-