1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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   */
22  
23  package com.liferay.portlet.bookmarks.service.impl;
24  
25  import com.liferay.portal.PortalException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.security.permission.ActionKeys;
28  import com.liferay.portlet.bookmarks.model.BookmarksEntry;
29  import com.liferay.portlet.bookmarks.service.base.BookmarksEntryServiceBaseImpl;
30  import com.liferay.portlet.bookmarks.service.permission.BookmarksEntryPermission;
31  import com.liferay.portlet.bookmarks.service.permission.BookmarksFolderPermission;
32  
33  /**
34   * <a href="BookmarksEntryServiceImpl.java.html"><b><i>View Source</i></b></a>
35   *
36   * @author Brian Wing Shun Chan
37   */
38  public class BookmarksEntryServiceImpl extends BookmarksEntryServiceBaseImpl {
39  
40      public BookmarksEntry addEntry(
41              long folderId, String name, String url, String comments,
42              String[] tagsEntries, boolean addCommunityPermissions,
43              boolean addGuestPermissions)
44          throws PortalException, SystemException {
45  
46          BookmarksFolderPermission.check(
47              getPermissionChecker(), folderId, ActionKeys.ADD_ENTRY);
48  
49          return bookmarksEntryLocalService.addEntry(
50              getUserId(), folderId, name, url, comments, tagsEntries,
51              addCommunityPermissions, addGuestPermissions);
52      }
53  
54      public BookmarksEntry addEntry(
55              long folderId, String name, String url, String comments,
56              String[] tagsEntries, String[] communityPermissions,
57              String[] guestPermissions)
58          throws PortalException, SystemException {
59  
60          BookmarksFolderPermission.check(
61              getPermissionChecker(), folderId, ActionKeys.ADD_ENTRY);
62  
63          return bookmarksEntryLocalService.addEntry(
64              getUserId(), folderId, name, url, comments, tagsEntries,
65              communityPermissions, guestPermissions);
66      }
67  
68      public void deleteEntry(long entryId)
69          throws PortalException, SystemException {
70  
71          BookmarksEntryPermission.check(
72              getPermissionChecker(), entryId, ActionKeys.DELETE);
73  
74          bookmarksEntryLocalService.deleteEntry(entryId);
75      }
76  
77      public BookmarksEntry getEntry(long entryId)
78          throws PortalException, SystemException {
79  
80          BookmarksEntryPermission.check(
81              getPermissionChecker(), entryId, ActionKeys.VIEW);
82  
83          return bookmarksEntryLocalService.getEntry(entryId);
84      }
85  
86      public BookmarksEntry openEntry(long entryId)
87          throws PortalException, SystemException {
88  
89          BookmarksEntryPermission.check(
90              getPermissionChecker(), entryId, ActionKeys.VIEW);
91  
92          return bookmarksEntryLocalService.openEntry(entryId);
93      }
94  
95      public BookmarksEntry updateEntry(
96              long entryId, long folderId, String name, String url,
97              String comments, String[] tagsEntries)
98          throws PortalException, SystemException {
99  
100         BookmarksEntryPermission.check(
101             getPermissionChecker(), entryId, ActionKeys.UPDATE);
102 
103         return bookmarksEntryLocalService.updateEntry(
104             getUserId(), entryId, folderId, name, url, comments, tagsEntries);
105     }
106 
107 }