1
22
23 package com.liferay.portlet.calendar.service.impl;
24
25 import com.liferay.portal.PortalException;
26 import com.liferay.portal.SystemException;
27 import com.liferay.portal.kernel.cal.TZSRecurrence;
28 import com.liferay.portal.security.permission.ActionKeys;
29 import com.liferay.portal.service.ServiceContext;
30 import com.liferay.portlet.calendar.model.CalEvent;
31 import com.liferay.portlet.calendar.service.base.CalEventServiceBaseImpl;
32 import com.liferay.portlet.calendar.service.permission.CalEventPermission;
33 import com.liferay.portlet.calendar.service.permission.CalendarPermission;
34
35 import java.io.File;
36
37
42 public class CalEventServiceImpl extends CalEventServiceBaseImpl {
43
44 public CalEvent addEvent(
45 String title, String description, int startDateMonth,
46 int startDateDay, int startDateYear, int startDateHour,
47 int startDateMinute, int endDateMonth, int endDateDay,
48 int endDateYear, int durationHour, int durationMinute,
49 boolean allDay, boolean timeZoneSensitive, String type,
50 boolean repeating, TZSRecurrence recurrence, int remindBy,
51 int firstReminder, int secondReminder,
52 ServiceContext serviceContext)
53 throws PortalException, SystemException {
54
55 CalendarPermission.check(
56 getPermissionChecker(), serviceContext.getScopeGroupId(),
57 ActionKeys.ADD_EVENT);
58
59 return calEventLocalService.addEvent(
60 getUserId(), title, description, startDateMonth, startDateDay,
61 startDateYear, startDateHour, startDateMinute, endDateMonth,
62 endDateDay, endDateYear, durationHour, durationMinute, allDay,
63 timeZoneSensitive, type, repeating, recurrence, remindBy,
64 firstReminder, secondReminder, serviceContext);
65 }
66
67 public void deleteEvent(long eventId)
68 throws PortalException, SystemException {
69
70 CalEventPermission.check(
71 getPermissionChecker(), eventId, ActionKeys.DELETE);
72
73 calEventLocalService.deleteEvent(eventId);
74 }
75
76 public File exportEvent(long eventId)
77 throws PortalException, SystemException {
78
79 CalEventPermission.check(
80 getPermissionChecker(), eventId, ActionKeys.VIEW);
81
82 return calEventLocalService.exportEvent(getGuestOrUserId(), eventId);
83 }
84
85 public File exportGroupEvents(long groupId, String fileName)
86 throws PortalException, SystemException {
87
88 CalendarPermission.check(
89 getPermissionChecker(), groupId, ActionKeys.EXPORT_ALL_EVENTS);
90
91 return calEventLocalService.exportGroupEvents(
92 getUserId(), groupId, fileName);
93 }
94
95 public CalEvent getEvent(long eventId)
96 throws PortalException, SystemException {
97
98 CalEventPermission.check(
99 getPermissionChecker(), eventId, ActionKeys.VIEW);
100
101 return calEventLocalService.getEvent(eventId);
102 }
103
104 public void importICal4j(long groupId, File file)
105 throws PortalException, SystemException {
106
107 CalendarPermission.check(
108 getPermissionChecker(), groupId, ActionKeys.ADD_EVENT);
109
110 calEventLocalService.importICal4j(getUserId(), groupId, file);
111 }
112
113 public CalEvent updateEvent(
114 long eventId, String title, String description,
115 int startDateMonth, int startDateDay, int startDateYear,
116 int startDateHour, int startDateMinute, int endDateMonth,
117 int endDateDay, int endDateYear, int durationHour,
118 int durationMinute, boolean allDay, boolean timeZoneSensitive,
119 String type, boolean repeating, TZSRecurrence recurrence,
120 int remindBy, int firstReminder, int secondReminder,
121 ServiceContext serviceContext)
122 throws PortalException, SystemException {
123
124 CalEventPermission.check(
125 getPermissionChecker(), eventId, ActionKeys.UPDATE);
126
127 return calEventLocalService.updateEvent(
128 getUserId(), eventId, title, description, startDateMonth,
129 startDateDay, startDateYear, startDateHour, startDateMinute,
130 endDateMonth, endDateDay, endDateYear, durationHour, durationMinute,
131 allDay, timeZoneSensitive, type, repeating, recurrence, remindBy,
132 firstReminder, secondReminder, serviceContext);
133 }
134
135 }