1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
13   */
14  
15  package com.liferay.portlet.bookmarks.service.impl;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.security.permission.ActionKeys;
20  import com.liferay.portlet.bookmarks.model.BookmarksEntry;
21  import com.liferay.portlet.bookmarks.service.base.BookmarksEntryServiceBaseImpl;
22  import com.liferay.portlet.bookmarks.service.permission.BookmarksEntryPermission;
23  import com.liferay.portlet.bookmarks.service.permission.BookmarksFolderPermission;
24  
25  /**
26   * <a href="BookmarksEntryServiceImpl.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   */
30  public class BookmarksEntryServiceImpl extends BookmarksEntryServiceBaseImpl {
31  
32      public BookmarksEntry addEntry(
33              long folderId, String name, String url, String comments,
34              String[] tagsEntries, boolean addCommunityPermissions,
35              boolean addGuestPermissions)
36          throws PortalException, SystemException {
37  
38          BookmarksFolderPermission.check(
39              getPermissionChecker(), folderId, ActionKeys.ADD_ENTRY);
40  
41          return bookmarksEntryLocalService.addEntry(
42              getUserId(), folderId, name, url, comments, tagsEntries,
43              addCommunityPermissions, addGuestPermissions);
44      }
45  
46      public BookmarksEntry addEntry(
47              long folderId, String name, String url, String comments,
48              String[] tagsEntries, String[] communityPermissions,
49              String[] guestPermissions)
50          throws PortalException, SystemException {
51  
52          BookmarksFolderPermission.check(
53              getPermissionChecker(), folderId, ActionKeys.ADD_ENTRY);
54  
55          return bookmarksEntryLocalService.addEntry(
56              getUserId(), folderId, name, url, comments, tagsEntries,
57              communityPermissions, guestPermissions);
58      }
59  
60      public void deleteEntry(long entryId)
61          throws PortalException, SystemException {
62  
63          BookmarksEntryPermission.check(
64              getPermissionChecker(), entryId, ActionKeys.DELETE);
65  
66          bookmarksEntryLocalService.deleteEntry(entryId);
67      }
68  
69      public BookmarksEntry getEntry(long entryId)
70          throws PortalException, SystemException {
71  
72          BookmarksEntryPermission.check(
73              getPermissionChecker(), entryId, ActionKeys.VIEW);
74  
75          return bookmarksEntryLocalService.getEntry(entryId);
76      }
77  
78      public BookmarksEntry openEntry(long entryId)
79          throws PortalException, SystemException {
80  
81          BookmarksEntryPermission.check(
82              getPermissionChecker(), entryId, ActionKeys.VIEW);
83  
84          return bookmarksEntryLocalService.openEntry(entryId);
85      }
86  
87      public BookmarksEntry updateEntry(
88              long entryId, long folderId, String name, String url,
89              String comments, String[] tagsEntries)
90          throws PortalException, SystemException {
91  
92          BookmarksEntryPermission.check(
93              getPermissionChecker(), entryId, ActionKeys.UPDATE);
94  
95          return bookmarksEntryLocalService.updateEntry(
96              getUserId(), entryId, folderId, name, url, comments, tagsEntries);
97      }
98  
99  }