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