1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.journal.service.impl;
21  
22  import com.liferay.portal.PortalException;
23  import com.liferay.portal.SystemException;
24  import com.liferay.portal.security.permission.ActionKeys;
25  import com.liferay.portal.service.ServiceContext;
26  import com.liferay.portlet.journal.model.JournalFeed;
27  import com.liferay.portlet.journal.service.base.JournalFeedServiceBaseImpl;
28  import com.liferay.portlet.journal.service.permission.JournalFeedPermission;
29  import com.liferay.portlet.journal.service.permission.JournalPermission;
30  
31  /**
32   * <a href="JournalFeedServiceImpl.java.html"><b><i>View Source</i></b></a>
33   *
34   * @author Raymond Augé
35   *
36   */
37  public class JournalFeedServiceImpl extends JournalFeedServiceBaseImpl {
38  
39      public JournalFeed addFeed(
40              long groupId, String feedId, boolean autoFeedId, String name,
41              String description, String type, String structureId,
42              String templateId, String rendererTemplateId, int delta,
43              String orderByCol, String orderByType,
44              String targetLayoutFriendlyUrl, String targetPortletId,
45              String contentField, String feedType, double feedVersion,
46              ServiceContext serviceContext)
47          throws PortalException, SystemException {
48  
49          JournalPermission.check(
50              getPermissionChecker(), groupId, ActionKeys.ADD_FEED);
51  
52          return journalFeedLocalService.addFeed(
53              getUserId(), groupId, feedId, autoFeedId, name, description, type,
54              structureId, templateId, rendererTemplateId, delta, orderByCol,
55              orderByType, targetLayoutFriendlyUrl, targetPortletId, contentField,
56              feedType, feedVersion, serviceContext);
57      }
58  
59      public void deleteFeed(long groupId, long feedId)
60          throws PortalException, SystemException {
61  
62          JournalFeedPermission.check(
63              getPermissionChecker(), feedId, ActionKeys.DELETE);
64  
65          journalFeedLocalService.deleteFeed(feedId);
66      }
67  
68      public void deleteFeed(long groupId, String feedId)
69          throws PortalException, SystemException {
70  
71          JournalFeedPermission.check(
72              getPermissionChecker(), groupId, feedId, ActionKeys.DELETE);
73  
74          journalFeedLocalService.deleteFeed(groupId, feedId);
75      }
76  
77      public JournalFeed getFeed(long groupId, long feedId)
78          throws PortalException, SystemException {
79  
80          JournalFeedPermission.check(
81              getPermissionChecker(), feedId, ActionKeys.VIEW);
82  
83          return journalFeedLocalService.getFeed(feedId);
84      }
85  
86      public JournalFeed getFeed(long groupId, String feedId)
87          throws PortalException, SystemException {
88  
89          JournalFeedPermission.check(
90              getPermissionChecker(), groupId, feedId, ActionKeys.VIEW);
91  
92          return journalFeedLocalService.getFeed(groupId, feedId);
93      }
94  
95      public JournalFeed updateFeed(
96              long groupId, String feedId, String name, String description,
97              String type, String structureId, String templateId,
98              String rendererTemplateId, int delta, String orderByCol,
99              String orderByType, String targetLayoutFriendlyUrl,
100             String targetPortletId, String contentField, String feedType,
101             double feedVersion, ServiceContext serviceContext)
102         throws PortalException, SystemException {
103 
104         JournalFeedPermission.check(
105             getPermissionChecker(), groupId, feedId, ActionKeys.UPDATE);
106 
107         return journalFeedLocalService.updateFeed(
108             groupId, feedId, name, description, type, structureId, templateId,
109             rendererTemplateId, delta, orderByCol, orderByType,
110             targetLayoutFriendlyUrl, targetPortletId, contentField, feedType,
111             feedVersion, serviceContext);
112     }
113 
114 }