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