001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.journal.service.impl;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.jsonwebservice.JSONWebService;
019    import com.liferay.portal.kernel.jsonwebservice.JSONWebServiceMode;
020    import com.liferay.portal.security.permission.ActionKeys;
021    import com.liferay.portal.service.ServiceContext;
022    import com.liferay.portlet.journal.model.JournalFeed;
023    import com.liferay.portlet.journal.service.base.JournalFeedServiceBaseImpl;
024    import com.liferay.portlet.journal.service.permission.JournalFeedPermission;
025    import com.liferay.portlet.journal.service.permission.JournalPermission;
026    
027    /**
028     * @author Raymond Aug??
029     */
030    public class JournalFeedServiceImpl extends JournalFeedServiceBaseImpl {
031    
032            @Override
033            public JournalFeed addFeed(
034                            long groupId, String feedId, boolean autoFeedId, String name,
035                            String description, String ddmStructureKey, String ddmTemplateKey,
036                            String ddmRendererTemplateKey, int delta, String orderByCol,
037                            String orderByType, String targetLayoutFriendlyUrl,
038                            String targetPortletId, String contentField, String feedType,
039                            double feedVersion, ServiceContext serviceContext)
040                    throws PortalException {
041    
042                    JournalPermission.check(
043                            getPermissionChecker(), groupId, ActionKeys.ADD_FEED);
044    
045                    return journalFeedLocalService.addFeed(
046                            getUserId(), groupId, feedId, autoFeedId, name, description,
047                            ddmStructureKey, ddmTemplateKey, ddmRendererTemplateKey, delta,
048                            orderByCol, orderByType, targetLayoutFriendlyUrl, targetPortletId,
049                            contentField, feedType, feedVersion, serviceContext);
050            }
051    
052            @Override
053            public void deleteFeed(long feedId) throws PortalException {
054                    JournalFeedPermission.check(
055                            getPermissionChecker(), feedId, ActionKeys.DELETE);
056    
057                    journalFeedLocalService.deleteFeed(feedId);
058            }
059    
060            /**
061             * @deprecated As of 6.2.0, replaced by {@link #deleteFeed(long, String)}
062             */
063            @Deprecated
064            @JSONWebService(mode = JSONWebServiceMode.IGNORE)
065            @Override
066            public void deleteFeed(long groupId, long feedId) throws PortalException {
067                    deleteFeed(groupId, String.valueOf(feedId));
068            }
069    
070            @Override
071            public void deleteFeed(long groupId, String feedId) throws PortalException {
072                    JournalFeedPermission.check(
073                            getPermissionChecker(), groupId, feedId, ActionKeys.DELETE);
074    
075                    journalFeedLocalService.deleteFeed(groupId, feedId);
076            }
077    
078            @Override
079            public JournalFeed getFeed(long feedId) throws PortalException {
080                    JournalFeedPermission.check(
081                            getPermissionChecker(), feedId, ActionKeys.VIEW);
082    
083                    return journalFeedLocalService.getFeed(feedId);
084            }
085    
086            /**
087             * @deprecated As of 6.2.0, replaced by {@link #getFeed(long, String)}
088             */
089            @Deprecated
090            @JSONWebService(mode = JSONWebServiceMode.IGNORE)
091            @Override
092            public JournalFeed getFeed(long groupId, long feedId)
093                    throws PortalException {
094    
095                    return getFeed(groupId, String.valueOf(feedId));
096            }
097    
098            @Override
099            public JournalFeed getFeed(long groupId, String feedId)
100                    throws PortalException {
101    
102                    JournalFeedPermission.check(
103                            getPermissionChecker(), groupId, feedId, ActionKeys.VIEW);
104    
105                    return journalFeedLocalService.getFeed(groupId, feedId);
106            }
107    
108            @Override
109            public JournalFeed updateFeed(
110                            long groupId, String feedId, String name, String description,
111                            String ddmStructureKey, String ddmTemplateKey,
112                            String ddmRendererTemplateKey, int delta, String orderByCol,
113                            String orderByType, String targetLayoutFriendlyUrl,
114                            String targetPortletId, String contentField, String feedType,
115                            double feedVersion, ServiceContext serviceContext)
116                    throws PortalException {
117    
118                    JournalFeedPermission.check(
119                            getPermissionChecker(), groupId, feedId, ActionKeys.UPDATE);
120    
121                    return journalFeedLocalService.updateFeed(
122                            groupId, feedId, name, description, ddmStructureKey, ddmTemplateKey,
123                            ddmRendererTemplateKey, delta, orderByCol, orderByType,
124                            targetLayoutFriendlyUrl, targetPortletId, contentField, feedType,
125                            feedVersion, serviceContext);
126            }
127    
128    }