001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.calendar.service.impl;
022:
023: import com.liferay.portal.PortalException;
024: import com.liferay.portal.SystemException;
025: import com.liferay.portal.kernel.cal.Recurrence;
026: import com.liferay.portal.kernel.security.permission.ActionKeys;
027: import com.liferay.portal.service.permission.PortletPermissionUtil;
028: import com.liferay.portal.util.PortletKeys;
029: import com.liferay.portlet.calendar.model.CalEvent;
030: import com.liferay.portlet.calendar.service.base.CalEventServiceBaseImpl;
031: import com.liferay.portlet.calendar.service.permission.CalEventPermission;
032:
033: import java.io.File;
034:
035: /**
036: * <a href="CalEventServiceImpl.java.html"><b><i>View Source</i></b></a>
037: *
038: * @author Brian Wing Shun Chan
039: *
040: */
041: public class CalEventServiceImpl extends CalEventServiceBaseImpl {
042:
043: public CalEvent addEvent(long plid, String title,
044: String description, int startDateMonth, int startDateDay,
045: int startDateYear, int startDateHour, int startDateMinute,
046: int endDateMonth, int endDateDay, int endDateYear,
047: int durationHour, int durationMinute, boolean allDay,
048: boolean timeZoneSensitive, String type, boolean repeating,
049: Recurrence recurrence, String remindBy, int firstReminder,
050: int secondReminder, boolean addCommunityPermissions,
051: boolean addGuestPermissions) throws PortalException,
052: SystemException {
053:
054: PortletPermissionUtil.check(getPermissionChecker(), plid,
055: PortletKeys.CALENDAR, ActionKeys.ADD_EVENT);
056:
057: return calEventLocalService.addEvent(getUserId(), plid, title,
058: description, startDateMonth, startDateDay,
059: startDateYear, startDateHour, startDateMinute,
060: endDateMonth, endDateDay, endDateYear, durationHour,
061: durationMinute, allDay, timeZoneSensitive, type,
062: repeating, recurrence, remindBy, firstReminder,
063: secondReminder, addCommunityPermissions,
064: addGuestPermissions);
065: }
066:
067: public CalEvent addEvent(long plid, String title,
068: String description, int startDateMonth, int startDateDay,
069: int startDateYear, int startDateHour, int startDateMinute,
070: int endDateMonth, int endDateDay, int endDateYear,
071: int durationHour, int durationMinute, boolean allDay,
072: boolean timeZoneSensitive, String type, boolean repeating,
073: Recurrence recurrence, String remindBy, int firstReminder,
074: int secondReminder, String[] communityPermissions,
075: String[] guestPermissions) throws PortalException,
076: SystemException {
077:
078: PortletPermissionUtil.check(getPermissionChecker(), plid,
079: PortletKeys.CALENDAR, ActionKeys.ADD_EVENT);
080:
081: return calEventLocalService.addEvent(getUserId(), plid, title,
082: description, startDateMonth, startDateDay,
083: startDateYear, startDateHour, startDateMinute,
084: endDateMonth, endDateDay, endDateYear, durationHour,
085: durationMinute, allDay, timeZoneSensitive, type,
086: repeating, recurrence, remindBy, firstReminder,
087: secondReminder, communityPermissions, guestPermissions);
088: }
089:
090: public void deleteEvent(long eventId) throws PortalException,
091: SystemException {
092:
093: CalEventPermission.check(getPermissionChecker(), eventId,
094: ActionKeys.DELETE);
095:
096: calEventLocalService.deleteEvent(eventId);
097: }
098:
099: public File exportEvent(long eventId) throws PortalException,
100: SystemException {
101:
102: CalEventPermission.check(getPermissionChecker(), eventId,
103: ActionKeys.VIEW);
104:
105: return calEventLocalService.exportEvent(getUserId(), eventId);
106: }
107:
108: public File exportGroupEvents(long plid, String fileName)
109: throws PortalException, SystemException {
110:
111: PortletPermissionUtil.check(getPermissionChecker(), plid,
112: PortletKeys.CALENDAR, ActionKeys.EXPORT_ALL_EVENTS);
113:
114: return calEventLocalService.exportGroupEvents(getUserId(),
115: plid, fileName);
116: }
117:
118: public CalEvent getEvent(long eventId) throws PortalException,
119: SystemException {
120:
121: CalEventPermission.check(getPermissionChecker(), eventId,
122: ActionKeys.VIEW);
123:
124: return calEventLocalService.getEvent(eventId);
125: }
126:
127: public void importICal4j(long plid, File file)
128: throws PortalException, SystemException {
129:
130: PortletPermissionUtil.check(getPermissionChecker(), plid,
131: PortletKeys.CALENDAR, ActionKeys.ADD_EVENT);
132:
133: calEventLocalService.importICal4j(getUserId(), plid, file);
134: }
135:
136: public CalEvent updateEvent(long eventId, String title,
137: String description, int startDateMonth, int startDateDay,
138: int startDateYear, int startDateHour, int startDateMinute,
139: int endDateMonth, int endDateDay, int endDateYear,
140: int durationHour, int durationMinute, boolean allDay,
141: boolean timeZoneSensitive, String type, boolean repeating,
142: Recurrence recurrence, String remindBy, int firstReminder,
143: int secondReminder) throws PortalException, SystemException {
144:
145: CalEventPermission.check(getPermissionChecker(), eventId,
146: ActionKeys.UPDATE);
147:
148: return calEventLocalService.updateEvent(getUserId(), eventId,
149: title, description, startDateMonth, startDateDay,
150: startDateYear, startDateHour, startDateMinute,
151: endDateMonth, endDateDay, endDateYear, durationHour,
152: durationMinute, allDay, timeZoneSensitive, type,
153: repeating, recurrence, remindBy, firstReminder,
154: secondReminder);
155: }
156:
157: }
|