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