1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.journal.service.impl;
16  
17  import com.liferay.portal.kernel.exception.PortalException;
18  import com.liferay.portal.kernel.exception.SystemException;
19  import com.liferay.portal.security.permission.ActionKeys;
20  import com.liferay.portal.service.ServiceContext;
21  import com.liferay.portlet.journal.model.JournalFeed;
22  import com.liferay.portlet.journal.service.base.JournalFeedServiceBaseImpl;
23  import com.liferay.portlet.journal.service.permission.JournalFeedPermission;
24  import com.liferay.portlet.journal.service.permission.JournalPermission;
25  
26  /**
27   * <a href="JournalFeedServiceImpl.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Raymond Augé
30   */
31  public class JournalFeedServiceImpl extends JournalFeedServiceBaseImpl {
32  
33      public JournalFeed addFeed(
34              long groupId, String feedId, boolean autoFeedId, String name,
35              String description, String type, String structureId,
36              String templateId, String rendererTemplateId, int delta,
37              String orderByCol, String orderByType,
38              String targetLayoutFriendlyUrl, String targetPortletId,
39              String contentField, String feedType, double feedVersion,
40              ServiceContext serviceContext)
41          throws PortalException, SystemException {
42  
43          JournalPermission.check(
44              getPermissionChecker(), groupId, ActionKeys.ADD_FEED);
45  
46          return journalFeedLocalService.addFeed(
47              getUserId(), groupId, feedId, autoFeedId, name, description, type,
48              structureId, templateId, rendererTemplateId, delta, orderByCol,
49              orderByType, targetLayoutFriendlyUrl, targetPortletId, contentField,
50              feedType, feedVersion, serviceContext);
51      }
52  
53      public void deleteFeed(long groupId, long feedId)
54          throws PortalException, SystemException {
55  
56          JournalFeedPermission.check(
57              getPermissionChecker(), feedId, ActionKeys.DELETE);
58  
59          journalFeedLocalService.deleteFeed(feedId);
60      }
61  
62      public void deleteFeed(long groupId, String feedId)
63          throws PortalException, SystemException {
64  
65          JournalFeedPermission.check(
66              getPermissionChecker(), groupId, feedId, ActionKeys.DELETE);
67  
68          journalFeedLocalService.deleteFeed(groupId, feedId);
69      }
70  
71      public JournalFeed getFeed(long groupId, long feedId)
72          throws PortalException, SystemException {
73  
74          JournalFeedPermission.check(
75              getPermissionChecker(), feedId, ActionKeys.VIEW);
76  
77          return journalFeedLocalService.getFeed(feedId);
78      }
79  
80      public JournalFeed getFeed(long groupId, String feedId)
81          throws PortalException, SystemException {
82  
83          JournalFeedPermission.check(
84              getPermissionChecker(), groupId, feedId, ActionKeys.VIEW);
85  
86          return journalFeedLocalService.getFeed(groupId, feedId);
87      }
88  
89      public JournalFeed updateFeed(
90              long groupId, String feedId, String name, String description,
91              String type, String structureId, String templateId,
92              String rendererTemplateId, int delta, String orderByCol,
93              String orderByType, String targetLayoutFriendlyUrl,
94              String targetPortletId, String contentField, String feedType,
95              double feedVersion, ServiceContext serviceContext)
96          throws PortalException, SystemException {
97  
98          JournalFeedPermission.check(
99              getPermissionChecker(), groupId, feedId, ActionKeys.UPDATE);
100 
101         return journalFeedLocalService.updateFeed(
102             groupId, feedId, name, description, type, structureId, templateId,
103             rendererTemplateId, delta, orderByCol, orderByType,
104             targetLayoutFriendlyUrl, targetPortletId, contentField, feedType,
105             feedVersion, serviceContext);
106     }
107 
108 }