Class CalendarEventJSONHelper
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.workspaces.calendars.AbstractCalendarDAO
-
- org.ametys.plugins.workspaces.calendars.events.CalendarEventJSONHelper
-
- All Implemented Interfaces:
Component
,Contextualizable
,LogEnabled
,Serviceable
public class CalendarEventJSONHelper extends AbstractCalendarDAO
Helper to convert events to JSON
-
-
Field Summary
Fields Modifier and Type Field Description protected CalendarDAO
_calendarDAO
Calendar DAOstatic String
ROLE
Avalon 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 CalendarEventJSONHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>
_eventAsJsonFullInfo(CalendarEvent event)
Retrieves the event additional info (rights, parent id, etc...)protected Map<String,Object>
_extractEventRightData(CalendarEvent event)
Internal method to extract the data concerning the right of the current user for an eventprotected Set<String>
_getUserRights(ExplorerNode node)
Get the user rights on the resource collectionMap<String,Object>
eventAsJson(CalendarEvent event, boolean fullInfo)
Get event infoMap<String,Object>
eventAsJsonWithOccurrence(CalendarEvent event, ZonedDateTime occurrenceDate, boolean fullInfo)
Get event info for a specific occurrenceMap<String,Object>
eventAsJsonWithOccurrences(CalendarEvent event, boolean fullInfo, ZonedDateTime startDate, ZonedDateTime endDate)
Get event infovoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.plugins.workspaces.calendars.AbstractCalendarDAO
_getProject, _getProjectName, contextualize
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_calendarDAO
protected CalendarDAO _calendarDAO
Calendar DAO
-
-
Constructor Detail
-
CalendarEventJSONHelper
public CalendarEventJSONHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractCalendarDAO
- Throws:
ServiceException
-
eventAsJsonWithOccurrence
public Map<String,Object> eventAsJsonWithOccurrence(CalendarEvent event, ZonedDateTime occurrenceDate, boolean fullInfo)
Get event info for a specific occurrence- Parameters:
event
- The eventoccurrenceDate
- the occurrencefullInfo
- true to include full info (rights, parent id, etc...)- Returns:
- the event data in a map
-
eventAsJsonWithOccurrences
public Map<String,Object> eventAsJsonWithOccurrences(CalendarEvent event, boolean fullInfo, ZonedDateTime startDate, ZonedDateTime endDate)
Get event info- Parameters:
event
- The eventfullInfo
- true to include full info (rights, parent id, etc...)startDate
- The start date.endDate
- The end date.- Returns:
- the event data in a map
-
eventAsJson
public Map<String,Object> eventAsJson(CalendarEvent event, boolean fullInfo)
Get event info- Parameters:
event
- The eventfullInfo
- true to include full info (rights, parent id, etc...)- Returns:
- the event data in a map
-
_eventAsJsonFullInfo
protected Map<String,Object> _eventAsJsonFullInfo(CalendarEvent event)
Retrieves the event additional info (rights, parent id, etc...)- Parameters:
event
- The event- Returns:
- the event additional info (rights, parent id, etc...) in a map
-
_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.
-
_getUserRights
protected Set<String> _getUserRights(ExplorerNode node)
Get the user rights on the resource collection- Parameters:
node
- The explorer node- Returns:
- The user's rights
-
-