Class CalendarResourceDAO
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.workspaces.calendars.AbstractCalendarDAO
-
- org.ametys.plugins.workspaces.calendars.resources.CalendarResourceDAO
-
- All Implemented Interfaces:
Component,Contextualizable,LogEnabled,Serviceable
public class CalendarResourceDAO extends AbstractCalendarDAO
Calendar Resource DAO
-
-
Field Summary
Fields Modifier and Type Field Description static StringROLEAvalon 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 CalendarResourceDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ModifiableTraversableAmetysObject_getCalendarResourcesRoot(String projectName)Get the resources rootprotected List<CalendarEvent>_getEvents(ZonedDateTime startDate, ZonedDateTime endDate)Get the events between two datesMap<String,Object>addResource(String title, String icon, String instructions, boolean renameIfExists)Add a calendarMap<String,Object>deleteResource(String id)Delete a calendarMap<String,Object>editResource(String id, String title, String icon, String instructions)Edit a resourceMap<String,Object>getCalendarResourceData(CalendarResource calendarResource)Get calendar infoList<CalendarResource>getProjectResources(Project project)Get all resources from given projetsList<Map<String,Object>>getResources()Get the resources from projectList<Map<String,Object>>loadResourcesWithAvailability(String eventId, String startDateAsStr, String endDateAsStr, String eventStartDateAsStr, String eventEndDateAsStr, String recurrenceType, boolean isFullDay, String originalOccurrenceStartAsStr, String zoneIdAsString)Get all available resources between two dates for a given id-
Methods inherited from class org.ametys.plugins.workspaces.calendars.AbstractCalendarDAO
_getProject, _getProjectName, contextualize, service
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Constructor Detail
-
CalendarResourceDAO
public CalendarResourceDAO()
-
-
Method Detail
-
deleteResource
public Map<String,Object> deleteResource(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
-
_getCalendarResourcesRoot
protected ModifiableTraversableAmetysObject _getCalendarResourcesRoot(String projectName)
Get the resources root- Parameters:
projectName- the project name- Returns:
- the resources root
-
getResources
public List<Map<String,Object>> getResources() throws IllegalAccessException
Get the resources from project- Returns:
- the list of resources
- Throws:
IllegalAccessException- If an error occurs when checking the rights
-
getProjectResources
public List<CalendarResource> getProjectResources(Project project)
Get all resources from given projets- Parameters:
project- the project- Returns:
- All resources as JSON
-
getCalendarResourceData
public Map<String,Object> getCalendarResourceData(CalendarResource calendarResource)
Get calendar info- Parameters:
calendarResource- The calendar- Returns:
- the calendar data in a map
-
addResource
public Map<String,Object> addResource(String title, String icon, String instructions, boolean renameIfExists) throws IllegalAccessException
Add a calendar- Parameters:
title- The resource titleicon- The resource iconinstructions- The resource instructionsrenameIfExists- True to rename if existing- Returns:
- The result map with id, parentId and name keys
- Throws:
IllegalAccessException- If the user has no sufficient rights
-
editResource
public Map<String,Object> editResource(String id, String title, String icon, String instructions) throws IllegalAccessException
Edit a resource- Parameters:
id- The id of the resourcetitle- The resource titleicon- The resource iconinstructions- The resource instructions- Returns:
- The result map with id, parentId and name keys
- Throws:
IllegalAccessException- If the user has no sufficient rights
-
loadResourcesWithAvailability
public List<Map<String,Object>> loadResourcesWithAvailability(String eventId, String startDateAsStr, String endDateAsStr, String eventStartDateAsStr, String eventEndDateAsStr, String recurrenceType, boolean isFullDay, String originalOccurrenceStartAsStr, String zoneIdAsString)
Get all available resources between two dates for a given id- Parameters:
eventId- the event idstartDateAsStr- The start date.endDateAsStr- The end date.eventStartDateAsStr- The start date.eventEndDateAsStr- The end date.recurrenceType- The recurrence type.isFullDay- Is the event full dayoriginalOccurrenceStartAsStr- original occurrence start datezoneIdAsString- The zone ID used for the dates- Returns:
- All available resources as JSON
-
_getEvents
protected List<CalendarEvent> _getEvents(ZonedDateTime startDate, ZonedDateTime endDate)
Get the events between two dates- Parameters:
startDate- Begin dateendDate- End date- Returns:
- the list of events
-
-