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.bookmarks.service.impl;
022:
023: import com.liferay.portal.PortalException;
024: import com.liferay.portal.SystemException;
025: import com.liferay.portal.kernel.security.permission.ActionKeys;
026: import com.liferay.portlet.bookmarks.model.BookmarksEntry;
027: import com.liferay.portlet.bookmarks.service.base.BookmarksEntryServiceBaseImpl;
028: import com.liferay.portlet.bookmarks.service.permission.BookmarksEntryPermission;
029: import com.liferay.portlet.bookmarks.service.permission.BookmarksFolderPermission;
030:
031: /**
032: * <a href="BookmarksEntryServiceImpl.java.html"><b><i>View Source</i></b></a>
033: *
034: * @author Brian Wing Shun Chan
035: *
036: */
037: public class BookmarksEntryServiceImpl extends
038: BookmarksEntryServiceBaseImpl {
039:
040: public BookmarksEntry addEntry(long folderId, String name,
041: String url, String comments, String[] tagsEntries,
042: boolean addCommunityPermissions, boolean addGuestPermissions)
043: throws PortalException, SystemException {
044:
045: BookmarksFolderPermission.check(getPermissionChecker(),
046: folderId, ActionKeys.ADD_ENTRY);
047:
048: return bookmarksEntryLocalService.addEntry(getUserId(),
049: folderId, name, url, comments, tagsEntries,
050: addCommunityPermissions, addGuestPermissions);
051: }
052:
053: public BookmarksEntry addEntry(long folderId, String name,
054: String url, String comments, String[] tagsEntries,
055: String[] communityPermissions, String[] guestPermissions)
056: throws PortalException, SystemException {
057:
058: BookmarksFolderPermission.check(getPermissionChecker(),
059: folderId, ActionKeys.ADD_ENTRY);
060:
061: return bookmarksEntryLocalService.addEntry(getUserId(),
062: folderId, name, url, comments, tagsEntries,
063: communityPermissions, guestPermissions);
064: }
065:
066: public void deleteEntry(long entryId) throws PortalException,
067: SystemException {
068:
069: BookmarksEntryPermission.check(getPermissionChecker(), entryId,
070: ActionKeys.DELETE);
071:
072: bookmarksEntryLocalService.deleteEntry(entryId);
073: }
074:
075: public BookmarksEntry getEntry(long entryId)
076: throws PortalException, SystemException {
077:
078: BookmarksEntryPermission.check(getPermissionChecker(), entryId,
079: ActionKeys.VIEW);
080:
081: return bookmarksEntryLocalService.getEntry(entryId);
082: }
083:
084: public BookmarksEntry openEntry(long entryId)
085: throws PortalException, SystemException {
086:
087: BookmarksEntryPermission.check(getPermissionChecker(), entryId,
088: ActionKeys.VIEW);
089:
090: return bookmarksEntryLocalService.openEntry(entryId);
091: }
092:
093: public BookmarksEntry updateEntry(long entryId, long folderId,
094: String name, String url, String comments,
095: String[] tagsEntries) throws PortalException,
096: SystemException {
097:
098: BookmarksEntryPermission.check(getPermissionChecker(), entryId,
099: ActionKeys.UPDATE);
100:
101: return bookmarksEntryLocalService.updateEntry(getUserId(),
102: entryId, folderId, name, url, comments, tagsEntries);
103: }
104:
105: }
|