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
Calendar Resource DAO
-
Field Summary
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected ModifiableTraversableAmetysObject
_getCalendarResourcesRoot
(String projectName) Get the resources rootprotected List<CalendarEvent>
_getEvents
(ZonedDateTime startDate, ZonedDateTime endDate) Get the events between two datesaddResource
(String title, String icon, String instructions, boolean renameIfExists) Add a calendardeleteResource
(String id) Delete a calendareditResource
(String id, String title, String icon, String instructions) Edit a resourcegetCalendarResourceData
(CalendarResource calendarResource) Get calendar infogetProjectResources
(Project project) Get all resources from given projetsGet the resources from projectloadResourcesWithAvailability
(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 idMethods 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
-
Field Details
-
ROLE
Avalon Role
-
-
Constructor Details
-
CalendarResourceDAO
public CalendarResourceDAO()
-
-
Method Details
-
deleteResource
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
Get the resources root- Parameters:
projectName
- the project name- Returns:
- the resources root
-
getResources
Get the resources from project- Returns:
- the list of resources
- Throws:
IllegalAccessException
- If an error occurs when checking the rights
-
getProjectResources
Get all resources from given projets- Parameters:
project
- the project- Returns:
- All resources as JSON
-
getCalendarResourceData
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
Get the events between two dates- Parameters:
startDate
- Begin dateendDate
- End date- Returns:
- the list of events
-