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
public class CalendarDAO extends AbstractLogEnabled implements Serviceable, Component
Calendar DAO
-
-
Field Summary
Fields Modifier and Type Field Description protected CurrentUserProvider_currentUserProviderThe current user provider.protected ExplorerResourcesDAO_explorerResourcesDAOExplorer resources DAOprotected ObservationManager_observationManagerObserver manager.protected AmetysObjectResolver_resolverAmetys resolverprotected RightManager_rightManagerThe rights managerprotected UserManager_userManagerUser managerprotected WorkflowHelper_workflowHelperThe workflow helperprotected WorkflowProvider_workflowProviderThe workflow providerstatic StringRIGHTS_CALENDAR_ADDRight to add a calendarstatic StringRIGHTS_CALENDAR_DELETERight to delete a calendarstatic StringRIGHTS_CALENDAR_EDITRight to edit a calendarstatic StringRIGHTS_EVENT_ADDRight to add a eventstatic StringRIGHTS_EVENT_DELETERight to delete a eventstatic StringRIGHTS_EVENT_DELETE_OWNRight to delete_own a eventstatic StringRIGHTS_EVENT_EDITRight to edit a eventstatic StringRIGHTS_EVENT_PROPOSERight to propose a eventstatic StringRIGHTS_EVENT_REFUSERight to refuse a eventstatic StringRIGHTS_EVENT_VALIDATERight to validate a eventstatic StringROLEAvalon Role
-
Constructor Summary
Constructors Constructor Description CalendarDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>_getEventDataFullInfo(CalendarEvent event)Retrieves the event additional info (rights, parent id, etc...)protected Set<String>_getUserRights(ExplorerNode node)Get the user rights on the resource collectionMap<String,Object>addCalendar(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists)Add a calendarMap<String,Object>addCalendar(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists, Boolean checkRights)Add a calendarMap<String,Object>deleteCalendar(String id)Delete a calendarMap<String,Object>deleteEvent(String id, String occurrence, String choice)Delete an eventMap<String,Object>doWorkflowEventAction(Map<String,Object> parameters)Do an event workflow actionMap<String,Object>editCalendar(String id, String inputName, String description, String templateDesc, String color, String visibility, String workflowName, Boolean renameIfExists, Boolean fullEdit)Edit a calendarMap<String,Object>getCalendarData(String id, boolean recursive, boolean includeEvents)Get calendar infoMap<String,Object>getCalendarData(Calendar calendar, boolean recursive, boolean includeEvents)Get calendar infoMap<String,Object>getEventData(CalendarEvent event, boolean fullInfo)Get event infoMap<String,Object>getEventData(CalendarEvent event, Date occurrenceDate, boolean fullInfo)Get event info for a specific occurrenceMap<String,Object>getEventDataById(String id, boolean fullInfo)Get event infoMap<String,Object>getEventDataById(String id, String occurrence, boolean fullInfo)Get event info for a specific occurrenceMap<String,Object>getEventOccurrenceData(CalendarEvent event, Date date)Get info about the occurrence of an eventList<Map<String,Object>>getEventsData(List<CalendarEvent> events, boolean fullInfo)Get event infoList<Map<String,Object>>getEventsDataByIds(List<String> ids, boolean fullInfo)Get event infoStringgetTemplateDescription(String calendarId)Get the template description of a calendarvoidmove(JCRCalendarEvent event, JCRCalendar parent)Move a event to another calendarvoidservice(ServiceManager manager)-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
RIGHTS_CALENDAR_ADD
public static final String RIGHTS_CALENDAR_ADD
Right to add a calendar- See Also:
- Constant Field Values
-
RIGHTS_CALENDAR_EDIT
public static final String RIGHTS_CALENDAR_EDIT
Right to edit a calendar- See Also:
- Constant Field Values
-
RIGHTS_CALENDAR_DELETE
public static final String RIGHTS_CALENDAR_DELETE
Right to delete a calendar- See Also:
- Constant Field Values
-
RIGHTS_EVENT_ADD
public static final String RIGHTS_EVENT_ADD
Right to add a event- See Also:
- Constant Field Values
-
RIGHTS_EVENT_EDIT
public static final String RIGHTS_EVENT_EDIT
Right to edit a event- See Also:
- Constant Field Values
-
RIGHTS_EVENT_PROPOSE
public static final String RIGHTS_EVENT_PROPOSE
Right to propose a event- See Also:
- Constant Field Values
-
RIGHTS_EVENT_VALIDATE
public static final String RIGHTS_EVENT_VALIDATE
Right to validate a event- See Also:
- Constant Field Values
-
RIGHTS_EVENT_REFUSE
public static final String RIGHTS_EVENT_REFUSE
Right to refuse a event- See Also:
- Constant Field Values
-
RIGHTS_EVENT_DELETE
public static final String RIGHTS_EVENT_DELETE
Right to delete a event- See Also:
- Constant Field Values
-
RIGHTS_EVENT_DELETE_OWN
public static final String RIGHTS_EVENT_DELETE_OWN
Right to delete_own a event- See Also:
- Constant Field Values
-
_explorerResourcesDAO
protected ExplorerResourcesDAO _explorerResourcesDAO
Explorer resources DAO
-
_resolver
protected AmetysObjectResolver _resolver
Ametys resolver
-
_observationManager
protected ObservationManager _observationManager
Observer manager.
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider.
-
_rightManager
protected RightManager _rightManager
The rights manager
-
_userManager
protected UserManager _userManager
User manager
-
_workflowProvider
protected WorkflowProvider _workflowProvider
The workflow provider
-
_workflowHelper
protected WorkflowHelper _workflowHelper
The workflow helper
-
-
Constructor Detail
-
CalendarDAO
public CalendarDAO()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getCalendarData
public Map<String,Object> getCalendarData(String id, boolean recursive, boolean includeEvents)
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
public String getTemplateDescription(String calendarId)
Get the template description of a calendar- Parameters:
calendarId- The identifier of the calendar- Returns:
- The template description
-
getEventsDataByIds
public List<Map<String,Object>> getEventsDataByIds(List<String> ids, boolean fullInfo)
Get event info- Parameters:
ids- The event idsfullInfo- true to include full info (rights, parent id, etc...)- Returns:
- the list of event data
-
getEventsData
public List<Map<String,Object>> getEventsData(List<CalendarEvent> events, boolean fullInfo)
Get event info- Parameters:
events- The eventsfullInfo- true to include full info (rights, parent id, etc...)- Returns:
- the list of event data
-
getEventDataById
public Map<String,Object> getEventDataById(String id, boolean fullInfo)
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
public Map<String,Object> getEventDataById(String id, String occurrence, boolean fullInfo)
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
public Map<String,Object> getEventData(CalendarEvent event, Date 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
-
getEventData
public Map<String,Object> getEventData(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
-
_getEventDataFullInfo
protected Map<String,Object> _getEventDataFullInfo(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
-
_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
-
getEventOccurrenceData
public Map<String,Object> getEventOccurrenceData(CalendarEvent event, Date date)
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
public void move(JCRCalendarEvent event, JCRCalendar parent) throws AmetysRepositoryException
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
public Map<String,Object> deleteCalendar(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
-
doWorkflowEventAction
public Map<String,Object> doWorkflowEventAction(Map<String,Object> parameters) throws com.opensymphony.workflow.WorkflowException
Do 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
-
-