1
14
15 package com.liferay.portlet.calendar.service.impl;
16
17 import com.liferay.portal.PortalException;
18 import com.liferay.portal.SystemException;
19 import com.liferay.portal.kernel.cal.TZSRecurrence;
20 import com.liferay.portal.security.permission.ActionKeys;
21 import com.liferay.portal.service.permission.PortletPermissionUtil;
22 import com.liferay.portal.util.PortletKeys;
23 import com.liferay.portlet.calendar.model.CalEvent;
24 import com.liferay.portlet.calendar.service.base.CalEventServiceBaseImpl;
25 import com.liferay.portlet.calendar.service.permission.CalEventPermission;
26
27 import java.io.File;
28
29
34 public class CalEventServiceImpl extends CalEventServiceBaseImpl {
35
36 public CalEvent addEvent(
37 long plid, 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 boolean addCommunityPermissions, boolean addGuestPermissions)
45 throws PortalException, SystemException {
46
47 PortletPermissionUtil.check(
48 getPermissionChecker(), plid, PortletKeys.CALENDAR,
49 ActionKeys.ADD_EVENT);
50
51 return calEventLocalService.addEvent(
52 getUserId(), plid, title, description, startDateMonth, startDateDay,
53 startDateYear, startDateHour, startDateMinute, endDateMonth,
54 endDateDay, endDateYear, durationHour, durationMinute, allDay,
55 timeZoneSensitive, type, repeating, recurrence, remindBy,
56 firstReminder, secondReminder, addCommunityPermissions,
57 addGuestPermissions);
58 }
59
60 public CalEvent addEvent(
61 long plid, String title, String description, int startDateMonth,
62 int startDateDay, int startDateYear, int startDateHour,
63 int startDateMinute, int endDateMonth, int endDateDay,
64 int endDateYear, int durationHour, int durationMinute,
65 boolean allDay, boolean timeZoneSensitive, String type,
66 boolean repeating, TZSRecurrence recurrence, int remindBy,
67 int firstReminder, int secondReminder,
68 String[] communityPermissions, String[] guestPermissions)
69 throws PortalException, SystemException {
70
71 PortletPermissionUtil.check(
72 getPermissionChecker(), plid, PortletKeys.CALENDAR,
73 ActionKeys.ADD_EVENT);
74
75 return calEventLocalService.addEvent(
76 getUserId(), plid, title, description, startDateMonth, startDateDay,
77 startDateYear, startDateHour, startDateMinute, endDateMonth,
78 endDateDay, endDateYear, durationHour, durationMinute, allDay,
79 timeZoneSensitive, type, repeating, recurrence, remindBy,
80 firstReminder, secondReminder, communityPermissions,
81 guestPermissions);
82 }
83
84 public void deleteEvent(long eventId)
85 throws PortalException, SystemException {
86
87 CalEventPermission.check(
88 getPermissionChecker(), eventId, ActionKeys.DELETE);
89
90 calEventLocalService.deleteEvent(eventId);
91 }
92
93 public File exportEvent(long eventId)
94 throws PortalException, SystemException {
95
96 CalEventPermission.check(
97 getPermissionChecker(), eventId, ActionKeys.VIEW);
98
99 return calEventLocalService.exportEvent(getGuestOrUserId(), eventId);
100 }
101
102 public File exportGroupEvents(long plid, String fileName)
103 throws PortalException, SystemException {
104
105 PortletPermissionUtil.check(
106 getPermissionChecker(), plid, PortletKeys.CALENDAR,
107 ActionKeys.EXPORT_ALL_EVENTS);
108
109 return calEventLocalService.exportGroupEvents(
110 getUserId(), plid, fileName);
111 }
112
113 public CalEvent getEvent(long eventId)
114 throws PortalException, SystemException {
115
116 CalEventPermission.check(
117 getPermissionChecker(), eventId, ActionKeys.VIEW);
118
119 return calEventLocalService.getEvent(eventId);
120 }
121
122 public void importICal4j(long plid, File file)
123 throws PortalException, SystemException {
124
125 PortletPermissionUtil.check(
126 getPermissionChecker(), plid, PortletKeys.CALENDAR,
127 ActionKeys.ADD_EVENT);
128
129 calEventLocalService.importICal4j(getUserId(), plid, file);
130 }
131
132 public CalEvent updateEvent(
133 long eventId, String title, String description,
134 int startDateMonth, int startDateDay, int startDateYear,
135 int startDateHour, int startDateMinute, int endDateMonth,
136 int endDateDay, int endDateYear, int durationHour,
137 int durationMinute, boolean allDay, boolean timeZoneSensitive,
138 String type, boolean repeating, TZSRecurrence recurrence,
139 int remindBy, int firstReminder, int secondReminder)
140 throws PortalException, SystemException {
141
142 CalEventPermission.check(
143 getPermissionChecker(), eventId, ActionKeys.UPDATE);
144
145 return calEventLocalService.updateEvent(
146 getUserId(), eventId, title, description, startDateMonth,
147 startDateDay, startDateYear, startDateHour, startDateMinute,
148 endDateMonth, endDateDay, endDateYear, durationHour, durationMinute,
149 allDay, timeZoneSensitive, type, repeating, recurrence, remindBy,
150 firstReminder, secondReminder);
151 }
152
153 }