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 type, String structureId,
036                            String templateId, String rendererTemplateId, int delta,
037                            String orderByCol, String orderByType,
038                            String targetLayoutFriendlyUrl, String targetPortletId,
039                            String contentField, String feedType, double feedVersion,
040                            ServiceContext serviceContext)
041                    throws PortalException {
042    
043                    JournalPermission.check(
044                            getPermissionChecker(), groupId, ActionKeys.ADD_FEED);
045    
046                    return journalFeedLocalService.addFeed(
047                            getUserId(), groupId, feedId, autoFeedId, name, description, type,
048                            structureId, templateId, rendererTemplateId, delta, orderByCol,
049                            orderByType, targetLayoutFriendlyUrl, targetPortletId, contentField,
050                            feedType, feedVersion, serviceContext);
051            }
052    
053            @Override
054            public void deleteFeed(long feedId) throws PortalException {
055                    JournalFeedPermission.check(
056                            getPermissionChecker(), feedId, ActionKeys.DELETE);
057    
058                    journalFeedLocalService.deleteFeed(feedId);
059            }
060    
061            /**
062             * @deprecated As of 6.2.0, replaced by {@link #deleteFeed(long, String)}
063             */
064            @Deprecated
065            @JSONWebService(mode = JSONWebServiceMode.IGNORE)
066            @Override
067            public void deleteFeed(long groupId, long feedId) throws PortalException {
068                    deleteFeed(groupId, String.valueOf(feedId));
069            }
070    
071            @Override
072            public void deleteFeed(long groupId, String feedId) throws PortalException {
073                    JournalFeedPermission.check(
074                            getPermissionChecker(), groupId, feedId, ActionKeys.DELETE);
075    
076                    journalFeedLocalService.deleteFeed(groupId, feedId);
077            }
078    
079            @Override
080            public JournalFeed getFeed(long feedId) throws PortalException {
081                    JournalFeedPermission.check(
082                            getPermissionChecker(), feedId, ActionKeys.VIEW);
083    
084                    return journalFeedLocalService.getFeed(feedId);
085            }
086    
087            /**
088             * @deprecated As of 6.2.0, replaced by {@link #getFeed(long, String)}
089             */
090            @Deprecated
091            @JSONWebService(mode = JSONWebServiceMode.IGNORE)
092            @Override
093            public JournalFeed getFeed(long groupId, long feedId)
094                    throws PortalException {
095    
096                    return getFeed(groupId, String.valueOf(feedId));
097            }
098    
099            @Override
100            public JournalFeed getFeed(long groupId, String feedId)
101                    throws PortalException {
102    
103                    JournalFeedPermission.check(
104                            getPermissionChecker(), groupId, feedId, ActionKeys.VIEW);
105    
106                    return journalFeedLocalService.getFeed(groupId, feedId);
107            }
108    
109            @Override
110            public JournalFeed updateFeed(
111                            long groupId, String feedId, String name, String description,
112                            String type, String structureId, String templateId,
113                            String rendererTemplateId, int delta, String orderByCol,
114                            String orderByType, String targetLayoutFriendlyUrl,
115                            String targetPortletId, String contentField, String feedType,
116                            double feedVersion, ServiceContext serviceContext)
117                    throws PortalException {
118    
119                    JournalFeedPermission.check(
120                            getPermissionChecker(), groupId, feedId, ActionKeys.UPDATE);
121    
122                    return journalFeedLocalService.updateFeed(
123                            groupId, feedId, name, description, type, structureId, templateId,
124                            rendererTemplateId, delta, orderByCol, orderByType,
125                            targetLayoutFriendlyUrl, targetPortletId, contentField, feedType,
126                            feedVersion, serviceContext);
127            }
128    
129    }