001
014
015 package com.liferay.portlet.bookmarks.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.security.permission.ActionKeys;
020 import com.liferay.portal.service.ServiceContext;
021 import com.liferay.portlet.bookmarks.model.BookmarksFolder;
022 import com.liferay.portlet.bookmarks.service.base.BookmarksFolderServiceBaseImpl;
023 import com.liferay.portlet.bookmarks.service.permission.BookmarksFolderPermission;
024
025
028 public class BookmarksFolderServiceImpl extends BookmarksFolderServiceBaseImpl {
029
030 public BookmarksFolder addFolder(
031 long parentFolderId, String name, String description,
032 ServiceContext serviceContext)
033 throws PortalException, SystemException {
034
035 BookmarksFolderPermission.check(
036 getPermissionChecker(), serviceContext.getScopeGroupId(),
037 parentFolderId, ActionKeys.ADD_FOLDER);
038
039 return bookmarksFolderLocalService.addFolder(
040 getUserId(), parentFolderId, name, description, serviceContext);
041 }
042
043 public void deleteFolder(long folderId)
044 throws PortalException, SystemException {
045
046 BookmarksFolder folder = bookmarksFolderLocalService.getFolder(
047 folderId);
048
049 BookmarksFolderPermission.check(
050 getPermissionChecker(), folder, ActionKeys.DELETE);
051
052 bookmarksFolderLocalService.deleteFolder(folderId);
053 }
054
055 public BookmarksFolder getFolder(long folderId)
056 throws PortalException, SystemException {
057
058 BookmarksFolder folder = bookmarksFolderLocalService.getFolder(
059 folderId);
060
061 BookmarksFolderPermission.check(
062 getPermissionChecker(), folder, ActionKeys.VIEW);
063
064 return folder;
065 }
066
067 public BookmarksFolder updateFolder(
068 long folderId, long parentFolderId, String name,
069 String description, boolean mergeWithParentFolder,
070 ServiceContext serviceContext)
071 throws PortalException, SystemException {
072
073 BookmarksFolder folder = bookmarksFolderLocalService.getFolder(
074 folderId);
075
076 BookmarksFolderPermission.check(
077 getPermissionChecker(), folder, ActionKeys.UPDATE);
078
079 return bookmarksFolderLocalService.updateFolder(
080 folderId, parentFolderId, name, description, mergeWithParentFolder,
081 serviceContext);
082 }
083
084 }