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
43 public class CalEventServiceImpl extends CalEventServiceBaseImpl {
44
45 public CalEvent addEvent(
46 String title, String description, int startDateMonth,
47 int startDateDay, int startDateYear, int startDateHour,
48 int startDateMinute, int endDateMonth, int endDateDay,
49 int endDateYear, int durationHour, int durationMinute,
50 boolean allDay, boolean timeZoneSensitive, String type,
51 boolean repeating, TZSRecurrence recurrence, int remindBy,
52 int firstReminder, int secondReminder,
53 ServiceContext serviceContext)
54 throws PortalException, SystemException {
55
56 CalendarPermission.check(
57 getPermissionChecker(), serviceContext.getScopeGroupId(),
58 ActionKeys.ADD_EVENT);
59
60 return calEventLocalService.addEvent(
61 getUserId(), title, description, startDateMonth, startDateDay,
62 startDateYear, startDateHour, startDateMinute, endDateMonth,
63 endDateDay, endDateYear, durationHour, durationMinute, allDay,
64 timeZoneSensitive, type, repeating, recurrence, remindBy,
65 firstReminder, secondReminder, serviceContext);
66 }
67
68 public void deleteEvent(long eventId)
69 throws PortalException, SystemException {
70
71 CalEventPermission.check(
72 getPermissionChecker(), eventId, ActionKeys.DELETE);
73
74 calEventLocalService.deleteEvent(eventId);
75 }
76
77 public File exportEvent(long eventId)
78 throws PortalException, SystemException {
79
80 CalEventPermission.check(
81 getPermissionChecker(), eventId, ActionKeys.VIEW);
82
83 return calEventLocalService.exportEvent(getGuestOrUserId(), eventId);
84 }
85
86 public File exportGroupEvents(long groupId, String fileName)
87 throws PortalException, SystemException {
88
89 CalendarPermission.check(
90 getPermissionChecker(), groupId, ActionKeys.EXPORT_ALL_EVENTS);
91
92 return calEventLocalService.exportGroupEvents(
93 getUserId(), groupId, fileName);
94 }
95
96 public CalEvent getEvent(long eventId)
97 throws PortalException, SystemException {
98
99 CalEventPermission.check(
100 getPermissionChecker(), eventId, ActionKeys.VIEW);
101
102 return calEventLocalService.getEvent(eventId);
103 }
104
105 public void importICal4j(long groupId, File file)
106 throws PortalException, SystemException {
107
108 CalendarPermission.check(
109 getPermissionChecker(), groupId, ActionKeys.ADD_EVENT);
110
111 calEventLocalService.importICal4j(getUserId(), groupId, file);
112 }
113
114 public CalEvent updateEvent(
115 long eventId, String title, String description,
116 int startDateMonth, int startDateDay, int startDateYear,
117 int startDateHour, int startDateMinute, int endDateMonth,
118 int endDateDay, int endDateYear, int durationHour,
119 int durationMinute, boolean allDay, boolean timeZoneSensitive,
120 String type, boolean repeating, TZSRecurrence recurrence,
121 int remindBy, int firstReminder, int secondReminder,
122 ServiceContext serviceContext)
123 throws PortalException, SystemException {
124
125 CalEventPermission.check(
126 getPermissionChecker(), eventId, ActionKeys.UPDATE);
127
128 return calEventLocalService.updateEvent(
129 getUserId(), eventId, title, description, startDateMonth,
130 startDateDay, startDateYear, startDateHour, startDateMinute,
131 endDateMonth, endDateDay, endDateYear, durationHour, durationMinute,
132 allDay, timeZoneSensitive, type, repeating, recurrence, remindBy,
133 firstReminder, secondReminder, serviceContext);
134 }
135
136 }