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
public class WorkspaceCalendarDAO extends CalendarDAO
DAO for manipulating calendars of a project
-
-
Field Summary
Fields Modifier and Type Field Description private MessagingConnectorCalendarManager_messagingConnectorCalendarManagerprivate ProjectManager_projectManagerstatic StringROLEAvalon Role-
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
Constructors Constructor Description WorkspaceCalendarDAO()
-
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 Map<String,Object>_extractEventRightData(CalendarEvent event)Internal method to extract the data concerning the right of the current user for an eventprotected Map<String,Object>_getAction(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)Get a map of data about an actionprotected List<Map<String,Object>>_getActions(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor)Get the actions of a workflowprotected Map<String,Object>_getStep(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, com.opensymphony.workflow.loader.StepDescriptor stepDescriptor)Get a map of data about a stepprotected List<Map<String,Object>>_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 inputMap<String,Object>addEvent(Map<String,Object> parameters)Add an eventMap<String,Object>deleteEvent(String id, String occurrence, String choice)Delete an eventMap<String,Object>editEvent(Map<String,Object> parameters)Edit an eventMap<String,Object>getCalendarData(Calendar calendar, boolean recursive, boolean includeEvents)Get calendar infoCalendargetCalendarFromIcsToken(String token)Retrieve the calendar for the matching ICS tokenMap<String,Object>getCalendarIcsToken(String calendarId)Get the ICS token for the given calendarStringgetCalendarIcsToken(Calendar calendar, boolean createIfNotExisting)Get or create the calendar ICS tokenMap<String,Object>getEventData(CalendarEvent event, boolean fullInfo)Get event infoList<Map<String,Object>>getWorkflows(boolean withSteps)Retrieves the available workflows for the calendarsMap<String,Object>getWorkflowState(String eventId)Get the workflow state of an eventvoidservice(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 Detail
-
_projectManager
private ProjectManager _projectManager
-
_messagingConnectorCalendarManager
private MessagingConnectorCalendarManager _messagingConnectorCalendarManager
-
-
Constructor Detail
-
WorkspaceCalendarDAO
public WorkspaceCalendarDAO()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classCalendarDAO- Throws:
ServiceException
-
addEvent
public Map<String,Object> addEvent(Map<String,Object> parameters) throws com.opensymphony.workflow.WorkflowException, IllegalAccessException
Add 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.WorkflowException
Edit 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:CalendarDAODelete an event- Overrides:
deleteEventin 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:CalendarDAOGet calendar info- Overrides:
getCalendarDatain 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
public Map<String,Object> getEventData(CalendarEvent event, boolean fullInfo)
Description copied from class:CalendarDAOGet event info- Overrides:
getEventDatain classCalendarDAO- Parameters:
event- The eventfullInfo- true to include full info (rights, parent id, etc...)- Returns:
- the event data in a map
-
getWorkflows
public List<Map<String,Object>> getWorkflows(boolean withSteps)
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
public Map<String,Object> getWorkflowState(String eventId)
Get the workflow state of an event- Parameters:
eventId- The id of the event- Returns:
- A map containing information about the workflow state
-
getCalendarIcsToken
public Map<String,Object> getCalendarIcsToken(String calendarId)
Get the ICS token for the given calendar- Parameters:
calendarId- The calendar id- Returns:
- The ICS token
-
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
-
_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
protected Map<String,Object> _extractEventRightData(CalendarEvent event)
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
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.
-
_sanitizeEventLocationsInput
protected String _sanitizeEventLocationsInput(Collection<String> locations)
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
protected Collection<String> _sanitizeEventKeywordsInput(Collection<String> keywords)
Sanitize the keyword parameters received as input- Parameters:
keywords- collection of keywords passed as an input- Returns:
- The sanitized collection
-
-