1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.journal.service.impl;
21  
22  import com.liferay.portal.PortalException;
23  import com.liferay.portal.SystemException;
24  import com.liferay.portal.security.permission.ActionKeys;
25  import com.liferay.portal.service.permission.PortletPermissionUtil;
26  import com.liferay.portal.util.PortletKeys;
27  import com.liferay.portlet.journal.model.JournalFeed;
28  import com.liferay.portlet.journal.service.base.JournalFeedServiceBaseImpl;
29  import com.liferay.portlet.journal.service.permission.JournalFeedPermission;
30  
31  /**
32   * <a href="JournalFeedServiceImpl.java.html"><b><i>View Source</i></b></a>
33   *
34   * @author Raymond Aug�
35   *
36   */
37  public class JournalFeedServiceImpl extends JournalFeedServiceBaseImpl {
38  
39      public JournalFeed addFeed(
40              long plid, String feedId, boolean autoFeedId, String name,
41              String description, String type, String structureId,
42              String templateId, String rendererTemplateId, int delta,
43              String orderByCol, String orderByType,
44              String targetLayoutFriendlyUrl, String targetPortletId,
45              String contentField, String feedType, double feedVersion,
46              boolean addCommunityPermissions, boolean addGuestPermissions)
47          throws PortalException, SystemException {
48  
49          PortletPermissionUtil.check(
50              getPermissionChecker(), plid, PortletKeys.JOURNAL,
51              ActionKeys.ADD_FEED);
52  
53          return journalFeedLocalService.addFeed(
54              getUserId(), plid, feedId, autoFeedId, name, description, type,
55              structureId, templateId, rendererTemplateId, delta, orderByCol,
56              orderByType, targetLayoutFriendlyUrl, targetPortletId, contentField,
57              feedType, feedVersion, addCommunityPermissions,
58              addGuestPermissions);
59      }
60  
61      public JournalFeed addFeed(
62              long plid, String feedId, boolean autoFeedId, String name,
63              String description, String type, String structureId,
64              String templateId, String rendererTemplateId, int delta,
65              String orderByCol, String orderByType,
66              String targetLayoutFriendlyUrl, String targetPortletId,
67              String contentField, String feedType, double feedVersion,
68              String[] communityPermissions, String[] guestPermissions)
69          throws PortalException, SystemException {
70  
71          PortletPermissionUtil.check(
72              getPermissionChecker(), plid, PortletKeys.JOURNAL,
73              ActionKeys.ADD_FEED);
74  
75          return journalFeedLocalService.addFeed(
76              getUserId(), plid, 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 }