Class WorkspaceCalendarDAO

All Implemented Interfaces:
Component, LogEnabled, Serviceable

public class WorkspaceCalendarDAO extends CalendarDAO
DAO for manipulating calendars of a project
  • Field Details

    • ROLE

      public static final String ROLE
      Avalon Role
  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Overrides:
      service in class CalendarDAO
      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 occurred
      IllegalAccessException - 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: CalendarDAO
      Delete an event
      Overrides:
      deleteEvent in class CalendarDAO
      Parameters:
      id - The id of the event
      occurrence - 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 class CalendarDAO
      Parameters:
      calendar - The calendar
      recursive - True to get data for sub calendars
      includeEvents - 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: CalendarDAO
      Get event info
      Overrides:
      getEventData in class CalendarDAO
      Parameters:
      event - The event
      fullInfo - 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

      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 calendar
      createIfNotExisting - 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 descriptor
      stepDescriptor - 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 descriptor
      actionDescriptor - 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