Class CalendarDAO

All Implemented Interfaces:
LogEnabled, Component, Contextualizable, Serviceable

public class CalendarDAO extends AbstractCalendarDAO
Calendar DAO
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Overrides:
      service in class AbstractCalendarDAO
      Throws:
      ServiceException
    • getCalendarData

      public Map<String,Object> getCalendarData(Calendar calendar, boolean recursive, boolean includeEvents, boolean useICSFormat)
      Get calendar info
      Parameters:
      calendar - The calendar
      recursive - True to get data for sub calendars
      includeEvents - True to also include child events
      useICSFormat - 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)
      Add a calendar
      Parameters:
      inputName - The desired name for the calendar
      color - The calendar color
      isPublic - true if the calendar is public
      Returns:
      The result map with id, parentId and name keys
    • addCalendar

      public Map<String,Object> addCalendar(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists)
      Add a calendar
      Parameters:
      id - The identifier of the parent in which the calendar will be added
      inputName - The desired name for the calendar
      description - The calendar description
      templateDesc - The calendar template description
      color - The calendar color
      visibility - The calendar visibility
      workflowName - The calendar workflow name
      renameIfExists - True to rename if existing
      Returns:
      The result map with id, parentId and name keys
    • 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)
      Add a calendar
      Parameters:
      parent - The parent in which the calendar will be added
      inputName - The desired name for the calendar
      description - The calendar description
      templateDesc - The calendar template description
      color - The calendar color
      visibility - The calendar visibility
      workflowName - The calendar workflow name
      renameIfExists - True to rename if existing
      checkRights - true to check if the current user have enough rights to create the calendar
      notify - True to notify the calendar creation
      Returns:
      The result map with id, parentId and name keys
    • editCalendar

      public Map<String,Object> editCalendar(String id, String inputName, String templateDesc, String color, boolean isPublic)
      Edit a calendar
      Parameters:
      id - The identifier of the calendar
      inputName - The new name
      templateDesc - The new calendar template description
      color - The calendar color
      isPublic - true if the calendar is public
      Returns:
      The result map with id and name keys
    • editTaskCalendar

      public Map<String,Object> editTaskCalendar(String inputName, String color, boolean isPublic, boolean disabled) throws IllegalAccessException
      Edit the task calendar
      Parameters:
      inputName - the input name
      color - the color
      isPublic - true if the calendar is public
      disabled - true if the calendar is disabled
      Returns:
      the calendar properties
      Throws:
      IllegalAccessException - if a right error occurred
    • deleteCalendar

      Delete a calendar
      Parameters:
      id - The id of the calendar
      Returns:
      The result map with id, parent id and message keys
    • 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
    • _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 on root calendar of current project
      Returns:
      the user rights
    • _getCalendarRoot

      protected ModifiableTraversableAmetysObject _getCalendarRoot(boolean createIfNotExist)
      Get the calendar root
      Parameters:
      createIfNotExist - true to create root if not exist yet
      Returns:
      the calendar root
    • _getCalendarRoot

      protected ModifiableTraversableAmetysObject _getCalendarRoot(Project project, boolean createIfNotExist)
      Get the calendar root form the project
      Parameters:
      project - the project
      createIfNotExist - true to create root if not exist yet
      Returns:
      the calendar root
    • getResourceCalendar

      Get the data of calendar used to store resources
      Returns:
      the calendar used to store resources
    • getTaskCalendar

      public TaskCalendar getTaskCalendar(Project project, boolean onlyIfEnabled)
      Get the task calendar
      Parameters:
      project - the project
      onlyIfEnabled - true to return the task calendar only if it is enabled
      Returns:
      the task calendar
    • hasTaskCalendarReadAccess

      public boolean hasTaskCalendarReadAccess(Project project)
      true if the current user has read access on the task calendar
      Parameters:
      project - the project
      Returns:
      true if the current user has read access on the task calendar