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.BookmarksFolder;
22  import com.liferay.portlet.bookmarks.service.base.BookmarksFolderServiceBaseImpl;
23  import com.liferay.portlet.bookmarks.service.permission.BookmarksFolderPermission;
24  
25  /**
26   * <a href="BookmarksFolderServiceImpl.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   */
30  public class BookmarksFolderServiceImpl extends BookmarksFolderServiceBaseImpl {
31  
32      public BookmarksFolder addFolder(
33              long parentFolderId, String name, String description,
34              ServiceContext serviceContext)
35          throws PortalException, SystemException {
36  
37          BookmarksFolderPermission.check(
38              getPermissionChecker(), serviceContext.getScopeGroupId(),
39              parentFolderId, ActionKeys.ADD_FOLDER);
40  
41          return bookmarksFolderLocalService.addFolder(
42              getUserId(), parentFolderId, name, description, serviceContext);
43      }
44  
45      public void deleteFolder(long folderId)
46          throws PortalException, SystemException {
47  
48          BookmarksFolderPermission.check(
49              getPermissionChecker(), folderId, ActionKeys.DELETE);
50  
51          bookmarksFolderLocalService.deleteFolder(folderId);
52      }
53  
54      public BookmarksFolder getFolder(long folderId)
55          throws PortalException, SystemException {
56  
57          BookmarksFolderPermission.check(
58              getPermissionChecker(), folderId, ActionKeys.VIEW);
59  
60          return bookmarksFolderLocalService.getFolder(folderId);
61      }
62  
63      public BookmarksFolder updateFolder(
64              long folderId, long parentFolderId, String name,
65              String description, boolean mergeWithParentFolder,
66              ServiceContext serviceContext)
67          throws PortalException, SystemException {
68  
69          BookmarksFolderPermission.check(
70              getPermissionChecker(), folderId, ActionKeys.UPDATE);
71  
72          return bookmarksFolderLocalService.updateFolder(
73              folderId, parentFolderId, name, description, mergeWithParentFolder,
74              serviceContext);
75      }
76  
77  }