1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * 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   */
22  
23  package com.liferay.portlet.journal.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.portal.service.ServiceContext;
29  import com.liferay.portlet.journal.model.JournalFeed;
30  import com.liferay.portlet.journal.service.base.JournalFeedServiceBaseImpl;
31  import com.liferay.portlet.journal.service.permission.JournalFeedPermission;
32  import com.liferay.portlet.journal.service.permission.JournalPermission;
33  
34  /**
35   * <a href="JournalFeedServiceImpl.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Raymond Augé
38   *
39   */
40  public class JournalFeedServiceImpl extends JournalFeedServiceBaseImpl {
41  
42      public JournalFeed addFeed(
43              long groupId, String feedId, boolean autoFeedId, String name,
44              String description, String type, String structureId,
45              String templateId, String rendererTemplateId, int delta,
46              String orderByCol, String orderByType,
47              String targetLayoutFriendlyUrl, String targetPortletId,
48              String contentField, String feedType, double feedVersion,
49              ServiceContext serviceContext)
50          throws PortalException, SystemException {
51  
52          JournalPermission.check(
53              getPermissionChecker(), groupId, ActionKeys.ADD_FEED);
54  
55          return journalFeedLocalService.addFeed(
56              getUserId(), groupId, feedId, autoFeedId, name, description, type,
57              structureId, templateId, rendererTemplateId, delta, orderByCol,
58              orderByType, targetLayoutFriendlyUrl, targetPortletId, contentField,
59              feedType, feedVersion, serviceContext);
60      }
61  
62      public void deleteFeed(long groupId, long feedId)
63          throws PortalException, SystemException {
64  
65          JournalFeedPermission.check(
66              getPermissionChecker(), feedId, ActionKeys.DELETE);
67  
68          journalFeedLocalService.deleteFeed(feedId);
69      }
70  
71      public void deleteFeed(long groupId, String feedId)
72          throws PortalException, SystemException {
73  
74          JournalFeedPermission.check(
75              getPermissionChecker(), groupId, feedId, ActionKeys.DELETE);
76  
77          journalFeedLocalService.deleteFeed(groupId, feedId);
78      }
79  
80      public JournalFeed getFeed(long groupId, long feedId)
81          throws PortalException, SystemException {
82  
83          JournalFeedPermission.check(
84              getPermissionChecker(), feedId, ActionKeys.VIEW);
85  
86          return journalFeedLocalService.getFeed(feedId);
87      }
88  
89      public JournalFeed getFeed(long groupId, String feedId)
90          throws PortalException, SystemException {
91  
92          JournalFeedPermission.check(
93              getPermissionChecker(), groupId, feedId, ActionKeys.VIEW);
94  
95          return journalFeedLocalService.getFeed(groupId, feedId);
96      }
97  
98      public JournalFeed updateFeed(
99              long groupId, String feedId, String name, String description,
100             String type, String structureId, String templateId,
101             String rendererTemplateId, int delta, String orderByCol,
102             String orderByType, String targetLayoutFriendlyUrl,
103             String targetPortletId, String contentField, String feedType,
104             double feedVersion, ServiceContext serviceContext)
105         throws PortalException, SystemException {
106 
107         JournalFeedPermission.check(
108             getPermissionChecker(), groupId, feedId, ActionKeys.UPDATE);
109 
110         return journalFeedLocalService.updateFeed(
111             groupId, feedId, name, description, type, structureId, templateId,
112             rendererTemplateId, delta, orderByCol, orderByType,
113             targetLayoutFriendlyUrl, targetPortletId, contentField, feedType,
114             feedVersion, serviceContext);
115     }
116 
117 }