Class CalendarDAO
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.explorer.calendars.actions.CalendarDAO
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
- Direct Known Subclasses:
WorkspaceCalendarDAO
Calendar DAO
-
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user provider.protected ExplorerResourcesDAO
Explorer resources DAOprotected ObservationManager
Observer manager.protected AmetysObjectResolver
Ametys resolverprotected RightManager
The rights managerprotected UserManager
User managerprotected WorkflowHelper
The workflow helperprotected WorkflowProvider
The workflow providerstatic final String
Right to add a calendarstatic final String
Right to delete a calendarstatic final String
Right to edit a calendarstatic final String
Right to add a eventstatic final String
Right to delete a eventstatic final String
Right to delete_own a eventstatic final String
Right to edit a eventstatic final String
Right to propose a eventstatic final String
Right to refuse a eventstatic final String
Right to validate a eventstatic final String
Avalon Role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves the event additional info (rights, parent id, etc...)_getUserRights
(ExplorerNode node) Get the user rights on the resource collectionaddCalendar
(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists) Add a calendaraddCalendar
(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists, Boolean checkRights) Add a calendardeleteCalendar
(String id) Delete a calendardeleteEvent
(String id, String occurrence, String choice) Delete an eventdoWorkflowEventAction
(Map<String, Object> parameters) Do an event workflow actioneditCalendar
(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists, Boolean fullEdit) Edit a calendargetCalendarData
(String id, boolean recursive, boolean includeEvents) Get calendar infogetCalendarData
(Calendar calendar, boolean recursive, boolean includeEvents) Get calendar infogetEventData
(CalendarEvent event, boolean fullInfo) Get event infogetEventData
(CalendarEvent event, Date occurrenceDate, boolean fullInfo) Get event info for a specific occurrencegetEventDataById
(String id, boolean fullInfo) Get event infogetEventDataById
(String id, String occurrence, boolean fullInfo) Get event info for a specific occurrencegetEventOccurrenceData
(CalendarEvent event, Date date) Get info about the occurrence of an eventgetEventsData
(List<CalendarEvent> events, boolean fullInfo) Get event infogetEventsDataByIds
(List<String> ids, boolean fullInfo) Get event infogetTemplateDescription
(String calendarId) Get the template description of a calendarvoid
move
(JCRCalendarEvent event, JCRCalendar parent) Move a event to another calendarvoid
service
(ServiceManager manager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
Avalon Role -
RIGHTS_CALENDAR_ADD
Right to add a calendar- See Also:
-
RIGHTS_CALENDAR_EDIT
Right to edit a calendar- See Also:
-
RIGHTS_CALENDAR_DELETE
Right to delete a calendar- See Also:
-
RIGHTS_EVENT_ADD
Right to add a event- See Also:
-
RIGHTS_EVENT_EDIT
Right to edit a event- See Also:
-
RIGHTS_EVENT_PROPOSE
Right to propose a event- See Also:
-
RIGHTS_EVENT_VALIDATE
Right to validate a event- See Also:
-
RIGHTS_EVENT_REFUSE
Right to refuse a event- See Also:
-
RIGHTS_EVENT_DELETE
Right to delete a event- See Also:
-
RIGHTS_EVENT_DELETE_OWN
Right to delete_own a event- See Also:
-
_explorerResourcesDAO
Explorer resources DAO -
_resolver
Ametys resolver -
_observationManager
Observer manager. -
_currentUserProvider
The current user provider. -
_rightManager
The rights manager -
_userManager
User manager -
_workflowProvider
The workflow provider -
_workflowHelper
The workflow helper
-
-
Constructor Details
-
CalendarDAO
public CalendarDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getCalendarData
Get calendar info- Parameters:
id
- The calendar idrecursive
- True to get data for sub calendarsincludeEvents
- True to also include child events- Returns:
- the calendar data in a map
-
getCalendarData
public Map<String,Object> getCalendarData(Calendar calendar, boolean recursive, boolean includeEvents) Get calendar info- Parameters:
calendar
- The calendarrecursive
- True to get data for sub calendarsincludeEvents
- True to also include child events- Returns:
- the calendar data in a map
-
getTemplateDescription
Get the template description of a calendar- Parameters:
calendarId
- The identifier of the calendar- Returns:
- The template description
-
getEventsDataByIds
Get event info- Parameters:
ids
- The event idsfullInfo
- true to include full info (rights, parent id, etc...)- Returns:
- the list of event data
-
getEventsData
Get event info- Parameters:
events
- The eventsfullInfo
- true to include full info (rights, parent id, etc...)- Returns:
- the list of event data
-
getEventDataById
Get event info- Parameters:
id
- The event idfullInfo
- true to include full info (rights, parent id, etc...)- Returns:
- the event data in a map
-
getEventDataById
Get event info for a specific occurrence- Parameters:
id
- The event idoccurrence
- a string representing the occurrence date (ISO format).fullInfo
- true to include full info (rights, parent id, etc...)- Returns:
- the event data in a map
-
getEventData
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
-
getEventData
Get event info- Parameters:
event
- The eventfullInfo
- true to include full info (rights, parent id, etc...)- Returns:
- the event data in a map
-
_getEventDataFullInfo
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
-
_getUserRights
Get the user rights on the resource collection- Parameters:
node
- The explorer node- Returns:
- The user's rights
-
getEventOccurrenceData
Get info about the occurrence of an event- Parameters:
event
- The eventdate
- The start date of the occurrence of the event- Returns:
- the event occurrence data in a map
-
addCalendar
public Map<String,Object> addCalendar(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists) throws IllegalAccessException Add a calendar- Parameters:
id
- The identifier of the parent in which the calendar will be addedinputName
- The desired name for the calendardescription
- The calendar descriptiontemplateDesc
- The calendar template descriptioncolor
- The calendar colorvisibility
- The calendar visibilityworkflowName
- The calendar workflow namerenameIfExists
- True to rename if existing- Returns:
- The result map with id, parentId and name keys
- Throws:
IllegalAccessException
- If the user has no sufficient rights
-
addCalendar
public Map<String,Object> addCalendar(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists, Boolean checkRights) throws IllegalAccessException Add a calendar- Parameters:
id
- The identifier of the parent in which the calendar will be addedinputName
- The desired name for the calendardescription
- The calendar descriptiontemplateDesc
- The calendar template descriptioncolor
- The calendar colorvisibility
- The calendar visibilityworkflowName
- The calendar workflow namerenameIfExists
- True to rename if existingcheckRights
- true to check if the current user have enough rights to create the calendar- Returns:
- The result map with id, parentId and name keys
- Throws:
IllegalAccessException
- If the user has no sufficient rights
-
editCalendar
public Map<String,Object> editCalendar(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists, Boolean fullEdit) throws IllegalAccessException Edit a calendar- Parameters:
id
- The identifier of the calendarinputName
- The new namedescription
- The new descriptiontemplateDesc
- The new calendar template descriptioncolor
- The calendar colorvisibility
- The calendar visibilityworkflowName
- The calendar workflow namerenameIfExists
- True to rename if existingfullEdit
- true to allow full edition, otherwise only the name will be changed- Returns:
- The result map with id and name keys
- Throws:
IllegalAccessException
- If the user has no sufficient rights
-
move
Move a event to another calendar- Parameters:
event
- The event to moveparent
- The new parent calendar- Throws:
AmetysRepositoryException
- if an error occurred while moving
-
deleteCalendar
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
-
doWorkflowEventAction
public Map<String,Object> doWorkflowEventAction(Map<String, Object> parameters) throws com.opensymphony.workflow.WorkflowExceptionDo an event workflow action- Parameters:
parameters
- The map of action parameters- Returns:
- The map of results populated by the 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 Delete an event- Parameters:
id
- The id of the eventoccurrence
- 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
-