1   /**
2    * Copyright (c) 2000-2010 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   *
12   * 
13   */
14  
15  package com.liferay.portlet.journal.service.impl;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.security.permission.ActionKeys;
20  import com.liferay.portal.service.permission.PortletPermissionUtil;
21  import com.liferay.portal.util.PortletKeys;
22  import com.liferay.portlet.journal.model.JournalFeed;
23  import com.liferay.portlet.journal.service.base.JournalFeedServiceBaseImpl;
24  import com.liferay.portlet.journal.service.permission.JournalFeedPermission;
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 plid, 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              boolean addCommunityPermissions, boolean addGuestPermissions)
41          throws PortalException, SystemException {
42  
43          PortletPermissionUtil.check(
44              getPermissionChecker(), plid, PortletKeys.JOURNAL,
45              ActionKeys.ADD_FEED);
46  
47          return journalFeedLocalService.addFeed(
48              getUserId(), plid, feedId, autoFeedId, name, description, type,
49              structureId, templateId, rendererTemplateId, delta, orderByCol,
50              orderByType, targetLayoutFriendlyUrl, targetPortletId, contentField,
51              feedType, feedVersion, addCommunityPermissions,
52              addGuestPermissions);
53      }
54  
55      public JournalFeed addFeed(
56              long plid, String feedId, boolean autoFeedId, String name,
57              String description, String type, String structureId,
58              String templateId, String rendererTemplateId, int delta,
59              String orderByCol, String orderByType,
60              String targetLayoutFriendlyUrl, String targetPortletId,
61              String contentField, String feedType, double feedVersion,
62              String[] communityPermissions, String[] guestPermissions)
63          throws PortalException, SystemException {
64  
65          PortletPermissionUtil.check(
66              getPermissionChecker(), plid, PortletKeys.JOURNAL,
67              ActionKeys.ADD_FEED);
68  
69          return journalFeedLocalService.addFeed(
70              getUserId(), plid, feedId, autoFeedId, name, description, type,
71              structureId, templateId, rendererTemplateId, delta, orderByCol,
72              orderByType, targetLayoutFriendlyUrl, targetPortletId, contentField,
73              feedType, feedVersion, communityPermissions, guestPermissions);
74      }
75  
76      public void deleteFeed(long groupId, long feedId)
77          throws PortalException, SystemException {
78  
79          JournalFeedPermission.check(
80              getPermissionChecker(), feedId, ActionKeys.DELETE);
81  
82          journalFeedLocalService.deleteFeed(feedId);
83      }
84  
85      public void deleteFeed(long groupId, String feedId)
86          throws PortalException, SystemException {
87  
88          JournalFeedPermission.check(
89              getPermissionChecker(), groupId, feedId, ActionKeys.DELETE);
90  
91          journalFeedLocalService.deleteFeed(groupId, feedId);
92      }
93  
94      public JournalFeed getFeed(long groupId, long feedId)
95          throws PortalException, SystemException {
96  
97          JournalFeedPermission.check(
98              getPermissionChecker(), feedId, ActionKeys.VIEW);
99  
100         return journalFeedLocalService.getFeed(feedId);
101     }
102 
103     public JournalFeed getFeed(long groupId, String feedId)
104         throws PortalException, SystemException {
105 
106         JournalFeedPermission.check(
107             getPermissionChecker(), groupId, feedId, ActionKeys.VIEW);
108 
109         return journalFeedLocalService.getFeed(groupId, feedId);
110     }
111 
112     public JournalFeed updateFeed(
113             long groupId, String feedId, String name, String description,
114             String type, String structureId, String templateId,
115             String rendererTemplateId, int delta, String orderByCol,
116             String orderByType, String targetLayoutFriendlyUrl,
117             String targetPortletId, String contentField, String feedType,
118             double feedVersion)
119         throws PortalException, SystemException {
120 
121         JournalFeedPermission.check(
122             getPermissionChecker(), groupId, feedId, ActionKeys.UPDATE);
123 
124         return journalFeedLocalService.updateFeed(
125             groupId, feedId, name, description, type, structureId, templateId,
126             rendererTemplateId, delta, orderByCol, orderByType,
127             targetLayoutFriendlyUrl, targetPortletId, contentField, feedType,
128             feedVersion);
129     }
130 
131 }