1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.bookmarks.service.impl;
24  
25  import com.liferay.portal.PortalException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.security.permission.ActionKeys;
28  import com.liferay.portal.service.ServiceContext;
29  import com.liferay.portlet.bookmarks.model.BookmarksEntry;
30  import com.liferay.portlet.bookmarks.service.base.BookmarksEntryServiceBaseImpl;
31  import com.liferay.portlet.bookmarks.service.permission.BookmarksEntryPermission;
32  import com.liferay.portlet.bookmarks.service.permission.BookmarksFolderPermission;
33  
34  /**
35   * <a href="BookmarksEntryServiceImpl.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Brian Wing Shun Chan
38   */
39  public class BookmarksEntryServiceImpl extends BookmarksEntryServiceBaseImpl {
40  
41      public BookmarksEntry addEntry(
42              long folderId, String name, String url, String comments,
43              ServiceContext serviceContext)
44          throws PortalException, SystemException {
45  
46          BookmarksFolderPermission.check(
47              getPermissionChecker(), folderId, ActionKeys.ADD_ENTRY);
48  
49          return bookmarksEntryLocalService.addEntry(
50              getUserId(), folderId, name, url, comments, serviceContext);
51      }
52  
53      public void deleteEntry(long entryId)
54          throws PortalException, SystemException {
55  
56          BookmarksEntryPermission.check(
57              getPermissionChecker(), entryId, ActionKeys.DELETE);
58  
59          bookmarksEntryLocalService.deleteEntry(entryId);
60      }
61  
62      public BookmarksEntry getEntry(long entryId)
63          throws PortalException, SystemException {
64  
65          BookmarksEntryPermission.check(
66              getPermissionChecker(), entryId, ActionKeys.VIEW);
67  
68          return bookmarksEntryLocalService.getEntry(entryId);
69      }
70  
71      public BookmarksEntry openEntry(long entryId)
72          throws PortalException, SystemException {
73  
74          BookmarksEntryPermission.check(
75              getPermissionChecker(), entryId, ActionKeys.VIEW);
76  
77          return bookmarksEntryLocalService.openEntry(entryId);
78      }
79  
80      public BookmarksEntry updateEntry(
81              long entryId, long folderId, String name, String url,
82              String comments, ServiceContext serviceContext)
83          throws PortalException, SystemException {
84  
85          BookmarksEntryPermission.check(
86              getPermissionChecker(), entryId, ActionKeys.UPDATE);
87  
88          return bookmarksEntryLocalService.updateEntry(
89              getUserId(), entryId, folderId, name, url, comments,
90              serviceContext);
91      }
92  
93  }