01: /**
02: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
03: *
04: * Permission is hereby granted, free of charge, to any person obtaining a copy
05: * of this software and associated documentation files (the "Software"), to deal
06: * in the Software without restriction, including without limitation the rights
07: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
08: * copies of the Software, and to permit persons to whom the Software is
09: * furnished to do so, subject to the following conditions:
10: *
11: * The above copyright notice and this permission notice shall be included in
12: * all copies or substantial portions 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: */package com.liferay.portlet.bookmarks.service.impl;
22:
23: import com.liferay.portal.PortalException;
24: import com.liferay.portal.SystemException;
25: import com.liferay.portal.kernel.security.permission.ActionKeys;
26: import com.liferay.portlet.bookmarks.model.BookmarksFolder;
27: import com.liferay.portlet.bookmarks.service.base.BookmarksFolderServiceBaseImpl;
28: import com.liferay.portlet.bookmarks.service.permission.BookmarksFolderPermission;
29:
30: /**
31: * <a href="BookmarksFolderServiceImpl.java.html"><b><i>View Source</i></b></a>
32: *
33: * @author Brian Wing Shun Chan
34: *
35: */
36: public class BookmarksFolderServiceImpl extends
37: BookmarksFolderServiceBaseImpl {
38:
39: public BookmarksFolder addFolder(long plid, long parentFolderId,
40: String name, String description,
41: boolean addCommunityPermissions, boolean addGuestPermissions)
42: throws PortalException, SystemException {
43:
44: BookmarksFolderPermission.check(getPermissionChecker(), plid,
45: parentFolderId, ActionKeys.ADD_FOLDER);
46:
47: return bookmarksFolderLocalService.addFolder(getUserId(), plid,
48: parentFolderId, name, description,
49: addCommunityPermissions, addGuestPermissions);
50: }
51:
52: public BookmarksFolder addFolder(long plid, long parentFolderId,
53: String name, String description,
54: String[] communityPermissions, String[] guestPermissions)
55: throws PortalException, SystemException {
56:
57: BookmarksFolderPermission.check(getPermissionChecker(), plid,
58: parentFolderId, ActionKeys.ADD_FOLDER);
59:
60: return bookmarksFolderLocalService.addFolder(getUserId(), plid,
61: parentFolderId, name, description,
62: communityPermissions, guestPermissions);
63: }
64:
65: public void deleteFolder(long folderId) throws PortalException,
66: SystemException {
67:
68: BookmarksFolderPermission.check(getPermissionChecker(),
69: folderId, ActionKeys.DELETE);
70:
71: bookmarksFolderLocalService.deleteFolder(folderId);
72: }
73:
74: public BookmarksFolder getFolder(long folderId)
75: throws PortalException, SystemException {
76:
77: BookmarksFolderPermission.check(getPermissionChecker(),
78: folderId, ActionKeys.VIEW);
79:
80: return bookmarksFolderLocalService.getFolder(folderId);
81: }
82:
83: public BookmarksFolder updateFolder(long folderId,
84: long parentFolderId, String name, String description,
85: boolean mergeWithParentFolder) throws PortalException,
86: SystemException {
87:
88: BookmarksFolderPermission.check(getPermissionChecker(),
89: folderId, ActionKeys.UPDATE);
90:
91: return bookmarksFolderLocalService.updateFolder(folderId,
92: parentFolderId, name, description,
93: mergeWithParentFolder);
94: }
95:
96: }
|