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.portal.service.ServiceContext;
21  import com.liferay.portlet.bookmarks.model.BookmarksEntry;
22  import com.liferay.portlet.bookmarks.service.base.BookmarksEntryServiceBaseImpl;
23  import com.liferay.portlet.bookmarks.service.permission.BookmarksEntryPermission;
24  import com.liferay.portlet.bookmarks.service.permission.BookmarksFolderPermission;
25  
26  /**
27   * <a href="BookmarksEntryServiceImpl.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class BookmarksEntryServiceImpl extends BookmarksEntryServiceBaseImpl {
32  
33      public BookmarksEntry addEntry(
34              long folderId, String name, String url, String comments,
35              ServiceContext serviceContext)
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, serviceContext);
43      }
44  
45      public void deleteEntry(long entryId)
46          throws PortalException, SystemException {
47  
48          BookmarksEntryPermission.check(
49              getPermissionChecker(), entryId, ActionKeys.DELETE);
50  
51          bookmarksEntryLocalService.deleteEntry(entryId);
52      }
53  
54      public BookmarksEntry getEntry(long entryId)
55          throws PortalException, SystemException {
56  
57          BookmarksEntryPermission.check(
58              getPermissionChecker(), entryId, ActionKeys.VIEW);
59  
60          return bookmarksEntryLocalService.getEntry(entryId);
61      }
62  
63      public BookmarksEntry openEntry(long entryId)
64          throws PortalException, SystemException {
65  
66          BookmarksEntryPermission.check(
67              getPermissionChecker(), entryId, ActionKeys.VIEW);
68  
69          return bookmarksEntryLocalService.openEntry(entryId);
70      }
71  
72      public BookmarksEntry updateEntry(
73              long entryId, long folderId, String name, String url,
74              String comments, ServiceContext serviceContext)
75          throws PortalException, SystemException {
76  
77          BookmarksEntryPermission.check(
78              getPermissionChecker(), entryId, ActionKeys.UPDATE);
79  
80          return bookmarksEntryLocalService.updateEntry(
81              getUserId(), entryId, folderId, name, url, comments,
82              serviceContext);
83      }
84  
85  }