1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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  public class JournalFeedServiceImpl extends JournalFeedServiceBaseImpl {
40  
41      public JournalFeed addFeed(
42              long plid, String feedId, boolean autoFeedId, String name,
43              String description, String type, String structureId,
44              String templateId, String rendererTemplateId, int delta,
45              String orderByCol, String orderByType,
46              String targetLayoutFriendlyUrl, String targetPortletId,
47              String contentField, String feedType, double feedVersion,
48              boolean addCommunityPermissions, boolean addGuestPermissions)
49          throws PortalException, SystemException {
50  
51          PortletPermissionUtil.check(
52              getPermissionChecker(), plid, PortletKeys.JOURNAL,
53              ActionKeys.ADD_FEED);
54  
55          return journalFeedLocalService.addFeed(
56              getUserId(), plid, feedId, autoFeedId, name, description, type,
57              structureId, templateId, rendererTemplateId, delta, orderByCol,
58              orderByType, targetLayoutFriendlyUrl, targetPortletId, contentField,
59              feedType, feedVersion, addCommunityPermissions,
60              addGuestPermissions);
61      }
62  
63      public JournalFeed addFeed(
64              long plid, String feedId, boolean autoFeedId, String name,
65              String description, String type, String structureId,
66              String templateId, String rendererTemplateId, int delta,
67              String orderByCol, String orderByType,
68              String targetLayoutFriendlyUrl, String targetPortletId,
69              String contentField, String feedType, double feedVersion,
70              String[] communityPermissions, String[] guestPermissions)
71          throws PortalException, SystemException {
72  
73          PortletPermissionUtil.check(
74              getPermissionChecker(), plid, PortletKeys.JOURNAL,
75              ActionKeys.ADD_FEED);
76  
77          return journalFeedLocalService.addFeed(
78              getUserId(), plid, feedId, autoFeedId, name, description, type,
79              structureId, templateId, rendererTemplateId, delta, orderByCol,
80              orderByType, targetLayoutFriendlyUrl, targetPortletId, contentField,
81              feedType, feedVersion, communityPermissions, guestPermissions);
82      }
83  
84      public void deleteFeed(long groupId, long feedId)
85          throws PortalException, SystemException {
86  
87          JournalFeedPermission.check(
88              getPermissionChecker(), feedId, ActionKeys.DELETE);
89  
90          journalFeedLocalService.deleteFeed(feedId);
91      }
92  
93      public void deleteFeed(long groupId, String feedId)
94          throws PortalException, SystemException {
95  
96          JournalFeedPermission.check(
97              getPermissionChecker(), groupId, feedId, ActionKeys.DELETE);
98  
99          journalFeedLocalService.deleteFeed(groupId, feedId);
100     }
101 
102     public JournalFeed getFeed(long groupId, long feedId)
103         throws PortalException, SystemException {
104 
105         JournalFeedPermission.check(
106             getPermissionChecker(), feedId, ActionKeys.VIEW);
107 
108         return journalFeedLocalService.getFeed(feedId);
109     }
110 
111     public JournalFeed getFeed(long groupId, String feedId)
112         throws PortalException, SystemException {
113 
114         JournalFeedPermission.check(
115             getPermissionChecker(), groupId, feedId, ActionKeys.VIEW);
116 
117         return journalFeedLocalService.getFeed(groupId, feedId);
118     }
119 
120     public JournalFeed updateFeed(
121             long groupId, String feedId, String name, String description,
122             String type, String structureId, String templateId,
123             String rendererTemplateId, int delta, String orderByCol,
124             String orderByType, String targetLayoutFriendlyUrl,
125             String targetPortletId, String contentField, String feedType,
126             double feedVersion)
127         throws PortalException, SystemException {
128 
129         JournalFeedPermission.check(
130             getPermissionChecker(), groupId, feedId, ActionKeys.UPDATE);
131 
132         return journalFeedLocalService.updateFeed(
133             groupId, feedId, name, description, type, structureId, templateId,
134             rendererTemplateId, delta, orderByCol, orderByType,
135             targetLayoutFriendlyUrl, targetPortletId, contentField, feedType,
136             feedVersion);
137     }
138 
139 }