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