Class WorkspaceCalendarDAO
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.explorer.calendars.actions.CalendarDAO
org.ametys.plugins.workspaces.calendars.WorkspaceCalendarDAO
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
DAO for manipulating calendars of a project
-
Field Summary
Fields inherited from class org.ametys.plugins.explorer.calendars.actions.CalendarDAO
_currentUserProvider, _explorerResourcesDAO, _observationManager, _resolver, _rightManager, _userManager, _workflowHelper, _workflowProvider, RIGHTS_CALENDAR_ADD, RIGHTS_CALENDAR_DELETE, RIGHTS_CALENDAR_EDIT, RIGHTS_EVENT_ADD, RIGHTS_EVENT_DELETE, RIGHTS_EVENT_DELETE_OWN, RIGHTS_EVENT_EDIT, RIGHTS_EVENT_PROPOSE, RIGHTS_EVENT_REFUSE, RIGHTS_EVENT_VALIDATE
-
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 calendarInternal method to extract the data concerning the right of the current user for an event_getAction
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) Get a map of data about an action_getActions
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) Get the actions of a workflow_getStep
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, com.opensymphony.workflow.loader.StepDescriptor stepDescriptor) Get a map of data about a step_getSteps
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) Get the steps of a workflowprotected Collection<String>
_sanitizeEventKeywordsInput
(Collection<String> keywords) Sanitize the keyword parameters received as inputprotected String
_sanitizeEventLocationsInput
(Collection<String> locations) Sanitize the locations parameters received as inputAdd an eventdeleteEvent
(String id, String occurrence, String choice) Delete an eventEdit an eventgetCalendarData
(Calendar calendar, boolean recursive, boolean includeEvents) Get calendar infogetCalendarFromIcsToken
(String token) Retrieve the calendar for the matching ICS tokengetCalendarIcsToken
(String calendarId) Get the ICS token for the given calendargetCalendarIcsToken
(Calendar calendar, boolean createIfNotExisting) Get or create the calendar ICS tokengetEventData
(CalendarEvent event, boolean fullInfo) Get event infogetWorkflows
(boolean withSteps) Retrieves the available workflows for the calendarsgetWorkflowState
(String eventId) Get the workflow state of an eventvoid
service
(ServiceManager manager) Methods inherited from class org.ametys.plugins.explorer.calendars.actions.CalendarDAO
_getEventDataFullInfo, _getUserRights, addCalendar, addCalendar, deleteCalendar, doWorkflowEventAction, editCalendar, getCalendarData, getEventData, getEventDataById, getEventDataById, getEventOccurrenceData, getEventsData, getEventsDataByIds, getTemplateDescription, move
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
Avalon Role
-
-
Constructor Details
-
WorkspaceCalendarDAO
public WorkspaceCalendarDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classCalendarDAO
- Throws:
ServiceException
-
addEvent
public Map<String,Object> addEvent(Map<String, Object> parameters) throws com.opensymphony.workflow.WorkflowException, IllegalAccessExceptionAdd an event- Parameters:
parameters
- The map of parameters to perform the action- Returns:
- The map of results populated by the underlying workflow action
- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurredIllegalAccessException
- If the user does not have the right to add an event
-
editEvent
public Map<String,Object> editEvent(Map<String, Object> parameters) throws com.opensymphony.workflow.WorkflowExceptionEdit an event- Parameters:
parameters
- The map of parameters to perform the action- Returns:
- The map of results populated by the underlying workflow action
- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurred
-
deleteEvent
public Map<String,Object> deleteEvent(String id, String occurrence, String choice) throws IllegalAccessException Description copied from class:CalendarDAO
Delete an event- Overrides:
deleteEvent
in classCalendarDAO
- Parameters:
id
- The id of the eventoccurrence
- a string representing the occurrence date (ISO format).choice
- The type of modification- Returns:
- The result map with id, parent id and message keys
- Throws:
IllegalAccessException
- If the user has no sufficient rights
-
getCalendarData
public Map<String,Object> getCalendarData(Calendar calendar, boolean recursive, boolean includeEvents) Description copied from class:CalendarDAO
Get calendar info- Overrides:
getCalendarData
in classCalendarDAO
- Parameters:
calendar
- The calendarrecursive
- True to get data for sub calendarsincludeEvents
- True to also include child events- Returns:
- the calendar data in a map
-
getEventData
Description copied from class:CalendarDAO
Get event info- Overrides:
getEventData
in classCalendarDAO
- Parameters:
event
- The eventfullInfo
- true to include full info (rights, parent id, etc...)- Returns:
- the event data in a map
-
getWorkflows
Retrieves the available workflows for the calendars- Parameters:
withSteps
- true to include the list of steps and corresponding actions- Returns:
- The list of workflow. Each entry is a map of data (id, label)
-
getWorkflowState
Get the workflow state of an event- Parameters:
eventId
- The id of the event- Returns:
- A map containing information about the workflow state
-
getCalendarIcsToken
Get the ICS token for the given calendar- Parameters:
calendarId
- The calendar id- Returns:
- The ICS token
-
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
-
_getSteps
protected List<Map<String,Object>> _getSteps(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) Get the steps of a workflow- Parameters:
workflowDescriptor
- workflow descriptor- Returns:
- The list of steps
-
_getStep
protected Map<String,Object> _getStep(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, com.opensymphony.workflow.loader.StepDescriptor stepDescriptor) Get a map of data about a step- Parameters:
workflowDescriptor
- workflow descriptorstepDescriptor
- step descriptor- Returns:
- The map of data
-
_getActions
protected List<Map<String,Object>> _getActions(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) Get the actions of a workflow- Parameters:
workflowDescriptor
- workflow descriptor- Returns:
- The list of steps
-
_getAction
protected Map<String,Object> _getAction(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) Get a map of data about an action- Parameters:
workflowDescriptor
- workflow descriptoractionDescriptor
- action descriptor- Returns:
- The map of data
-
_extractEventRightData
Internal method to extract the data concerning the right of the current user for an event- Parameters:
event
- The event- Returns:
- The map of right data. Keys are the rights id, and values indicates whether the current user has the right or not.
-
_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.
-
_sanitizeEventLocationsInput
Sanitize the locations parameters received as input- Parameters:
locations
- collection of locations passed as an input- Returns:
- The sanitized location, a single string that represent a comma-separated list of locations
-
_sanitizeEventKeywordsInput
Sanitize the keyword parameters received as input- Parameters:
keywords
- collection of keywords passed as an input- Returns:
- The sanitized collection
-