1
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.BookmarksFolder;
22 import com.liferay.portlet.bookmarks.service.base.BookmarksFolderServiceBaseImpl;
23 import com.liferay.portlet.bookmarks.service.permission.BookmarksFolderPermission;
24
25
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 null, getUserId(), parentFolderId, name, description,
43 serviceContext);
44 }
45
46 public void deleteFolder(long folderId)
47 throws PortalException, SystemException {
48
49 BookmarksFolder folder = bookmarksFolderLocalService.getFolder(
50 folderId);
51
52 BookmarksFolderPermission.check(
53 getPermissionChecker(), folder, ActionKeys.DELETE);
54
55 bookmarksFolderLocalService.deleteFolder(folderId);
56 }
57
58 public BookmarksFolder getFolder(long folderId)
59 throws PortalException, SystemException {
60
61 BookmarksFolder folder = bookmarksFolderLocalService.getFolder(
62 folderId);
63
64 BookmarksFolderPermission.check(
65 getPermissionChecker(), folder, ActionKeys.VIEW);
66
67 return folder;
68 }
69
70 public BookmarksFolder updateFolder(
71 long folderId, long parentFolderId, String name,
72 String description, boolean mergeWithParentFolder,
73 ServiceContext serviceContext)
74 throws PortalException, SystemException {
75
76 BookmarksFolder folder = bookmarksFolderLocalService.getFolder(
77 folderId);
78
79 BookmarksFolderPermission.check(
80 getPermissionChecker(), folder, ActionKeys.UPDATE);
81
82 return bookmarksFolderLocalService.updateFolder(
83 folderId, parentFolderId, name, description, mergeWithParentFolder,
84 serviceContext);
85 }
86
87 }