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