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