1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.bookmarks.service.impl;
16  
17  import com.liferay.portal.kernel.exception.PortalException;
18  import com.liferay.portal.kernel.exception.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 groupId, long folderId, String name, String url,
35              String comments, ServiceContext serviceContext)
36          throws PortalException, SystemException {
37  
38          BookmarksFolderPermission.check(
39              getPermissionChecker(), groupId, folderId, ActionKeys.ADD_ENTRY);
40  
41          return bookmarksEntryLocalService.addEntry(
42              null, getUserId(), groupId, folderId, name, url, comments,
43              serviceContext);
44      }
45  
46      public void deleteEntry(long entryId)
47          throws PortalException, SystemException {
48  
49          BookmarksEntryPermission.check(
50              getPermissionChecker(), entryId, ActionKeys.DELETE);
51  
52          bookmarksEntryLocalService.deleteEntry(entryId);
53      }
54  
55      public BookmarksEntry getEntry(long entryId)
56          throws PortalException, SystemException {
57  
58          BookmarksEntryPermission.check(
59              getPermissionChecker(), entryId, ActionKeys.VIEW);
60  
61          return bookmarksEntryLocalService.getEntry(entryId);
62      }
63  
64      public BookmarksEntry openEntry(long entryId)
65          throws PortalException, SystemException {
66  
67          BookmarksEntryPermission.check(
68              getPermissionChecker(), entryId, ActionKeys.VIEW);
69  
70          return bookmarksEntryLocalService.openEntry(entryId);
71      }
72  
73      public BookmarksEntry updateEntry(
74              long entryId, long groupId, long folderId, String name, String url,
75              String comments, ServiceContext serviceContext)
76          throws PortalException, SystemException {
77  
78          BookmarksEntryPermission.check(
79              getPermissionChecker(), entryId, ActionKeys.UPDATE);
80  
81          return bookmarksEntryLocalService.updateEntry(
82              getUserId(), entryId, groupId, folderId, name, url, comments,
83              serviceContext);
84      }
85  
86  }