001
014
015 package com.liferay.portlet.calendar.service.impl;
016
017 import com.liferay.portal.kernel.cal.TZSRecurrence;
018 import com.liferay.portal.kernel.exception.PortalException;
019 import com.liferay.portal.kernel.exception.SystemException;
020 import com.liferay.portal.security.permission.ActionKeys;
021 import com.liferay.portal.service.ServiceContext;
022 import com.liferay.portlet.calendar.model.CalEvent;
023 import com.liferay.portlet.calendar.service.base.CalEventServiceBaseImpl;
024 import com.liferay.portlet.calendar.service.permission.CalEventPermission;
025 import com.liferay.portlet.calendar.service.permission.CalendarPermission;
026
027 import java.io.File;
028
029
032 public class CalEventServiceImpl extends CalEventServiceBaseImpl {
033
034 public CalEvent addEvent(
035 String title, String description, int startDateMonth,
036 int startDateDay, int startDateYear, int startDateHour,
037 int startDateMinute, int endDateMonth, int endDateDay,
038 int endDateYear, int durationHour, int durationMinute,
039 boolean allDay, boolean timeZoneSensitive, String type,
040 boolean repeating, TZSRecurrence recurrence, int remindBy,
041 int firstReminder, int secondReminder,
042 ServiceContext serviceContext)
043 throws PortalException, SystemException {
044
045 CalendarPermission.check(
046 getPermissionChecker(), serviceContext.getScopeGroupId(),
047 ActionKeys.ADD_EVENT);
048
049 return calEventLocalService.addEvent(
050 getUserId(), title, description, startDateMonth, startDateDay,
051 startDateYear, startDateHour, startDateMinute, endDateMonth,
052 endDateDay, endDateYear, durationHour, durationMinute, allDay,
053 timeZoneSensitive, type, repeating, recurrence, remindBy,
054 firstReminder, secondReminder, serviceContext);
055 }
056
057 public void deleteEvent(long eventId)
058 throws PortalException, SystemException {
059
060 CalEventPermission.check(
061 getPermissionChecker(), eventId, ActionKeys.DELETE);
062
063 calEventLocalService.deleteEvent(eventId);
064 }
065
066 public File exportEvent(long eventId)
067 throws PortalException, SystemException {
068
069 CalEventPermission.check(
070 getPermissionChecker(), eventId, ActionKeys.VIEW);
071
072 return calEventLocalService.exportEvent(getGuestOrUserId(), eventId);
073 }
074
075 public File exportGroupEvents(long groupId, String fileName)
076 throws PortalException, SystemException {
077
078 CalendarPermission.check(
079 getPermissionChecker(), groupId, ActionKeys.EXPORT_ALL_EVENTS);
080
081 return calEventLocalService.exportGroupEvents(
082 getGuestOrUserId(), groupId, fileName);
083 }
084
085 public CalEvent getEvent(long eventId)
086 throws PortalException, SystemException {
087
088 CalEventPermission.check(
089 getPermissionChecker(), eventId, ActionKeys.VIEW);
090
091 return calEventLocalService.getEvent(eventId);
092 }
093
094 public void importICal4j(long groupId, File file)
095 throws PortalException, SystemException {
096
097 CalendarPermission.check(
098 getPermissionChecker(), groupId, ActionKeys.ADD_EVENT);
099
100 calEventLocalService.importICal4j(getUserId(), groupId, file);
101 }
102
103 public CalEvent updateEvent(
104 long eventId, String title, String description,
105 int startDateMonth, int startDateDay, int startDateYear,
106 int startDateHour, int startDateMinute, int endDateMonth,
107 int endDateDay, int endDateYear, int durationHour,
108 int durationMinute, boolean allDay, boolean timeZoneSensitive,
109 String type, boolean repeating, TZSRecurrence recurrence,
110 int remindBy, int firstReminder, int secondReminder,
111 ServiceContext serviceContext)
112 throws PortalException, SystemException {
113
114 CalEventPermission.check(
115 getPermissionChecker(), eventId, ActionKeys.UPDATE);
116
117 return calEventLocalService.updateEvent(
118 getUserId(), eventId, title, description, startDateMonth,
119 startDateDay, startDateYear, startDateHour, startDateMinute,
120 endDateMonth, endDateDay, endDateYear, durationHour, durationMinute,
121 allDay, timeZoneSensitive, type, repeating, recurrence, remindBy,
122 firstReminder, secondReminder, serviceContext);
123 }
124
125 }