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