001    /**
002     * Copyright (c) 2000-2013 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.exception.SystemException;
019    import com.liferay.portal.kernel.jsonwebservice.JSONWebService;
020    import com.liferay.portal.kernel.jsonwebservice.JSONWebServiceMode;
021    import com.liferay.portal.security.permission.ActionKeys;
022    import com.liferay.portal.service.ServiceContext;
023    import com.liferay.portlet.journal.model.JournalFeed;
024    import com.liferay.portlet.journal.service.base.JournalFeedServiceBaseImpl;
025    import com.liferay.portlet.journal.service.permission.JournalFeedPermission;
026    import com.liferay.portlet.journal.service.permission.JournalPermission;
027    
028    /**
029     * @author Raymond Aug??
030     */
031    public class JournalFeedServiceImpl extends JournalFeedServiceBaseImpl {
032    
033            @Override
034            public JournalFeed addFeed(
035                            long groupId, String feedId, boolean autoFeedId, String name,
036                            String description, String type, String structureId,
037                            String templateId, String rendererTemplateId, int delta,
038                            String orderByCol, String orderByType,
039                            String targetLayoutFriendlyUrl, String targetPortletId,
040                            String contentField, String feedType, double feedVersion,
041                            ServiceContext serviceContext)
042                    throws PortalException, SystemException {
043    
044                    JournalPermission.check(
045                            getPermissionChecker(), groupId, ActionKeys.ADD_FEED);
046    
047                    return journalFeedLocalService.addFeed(
048                            getUserId(), groupId, feedId, autoFeedId, name, description, type,
049                            structureId, templateId, rendererTemplateId, delta, orderByCol,
050                            orderByType, targetLayoutFriendlyUrl, targetPortletId, contentField,
051                            feedType, feedVersion, serviceContext);
052            }
053    
054            @Override
055            public void deleteFeed(long feedId)
056                    throws PortalException, SystemException {
057    
058                    JournalFeedPermission.check(
059                            getPermissionChecker(), feedId, ActionKeys.DELETE);
060    
061                    journalFeedLocalService.deleteFeed(feedId);
062            }
063    
064            /**
065             * @deprecated As of 6.2.0, replaced by {@link #deleteFeed(long, String)}
066             */
067            @JSONWebService(mode = JSONWebServiceMode.IGNORE)
068            @Override
069            public void deleteFeed(long groupId, long feedId)
070                    throws PortalException, SystemException {
071    
072                    deleteFeed(groupId, String.valueOf(feedId));
073            }
074    
075            @Override
076            public void deleteFeed(long groupId, String feedId)
077                    throws PortalException, SystemException {
078    
079                    JournalFeedPermission.check(
080                            getPermissionChecker(), groupId, feedId, ActionKeys.DELETE);
081    
082                    journalFeedLocalService.deleteFeed(groupId, feedId);
083            }
084    
085            @Override
086            public JournalFeed getFeed(long feedId)
087                    throws PortalException, SystemException {
088    
089                    JournalFeedPermission.check(
090                            getPermissionChecker(), feedId, ActionKeys.VIEW);
091    
092                    return journalFeedLocalService.getFeed(feedId);
093            }
094    
095            /**
096             * @deprecated As of 6.2.0, replaced by {@link #getFeed(long, String)}
097             */
098            @JSONWebService(mode = JSONWebServiceMode.IGNORE)
099            @Override
100            public JournalFeed getFeed(long groupId, long feedId)
101                    throws PortalException, SystemException {
102    
103                    return getFeed(groupId, String.valueOf(feedId));
104            }
105    
106            @Override
107            public JournalFeed getFeed(long groupId, String feedId)
108                    throws PortalException, SystemException {
109    
110                    JournalFeedPermission.check(
111                            getPermissionChecker(), groupId, feedId, ActionKeys.VIEW);
112    
113                    return journalFeedLocalService.getFeed(groupId, feedId);
114            }
115    
116            @Override
117            public JournalFeed updateFeed(
118                            long groupId, String feedId, String name, String description,
119                            String type, String structureId, String templateId,
120                            String rendererTemplateId, int delta, String orderByCol,
121                            String orderByType, String targetLayoutFriendlyUrl,
122                            String targetPortletId, String contentField, String feedType,
123                            double feedVersion, ServiceContext serviceContext)
124                    throws PortalException, SystemException {
125    
126                    JournalFeedPermission.check(
127                            getPermissionChecker(), groupId, feedId, ActionKeys.UPDATE);
128    
129                    return journalFeedLocalService.updateFeed(
130                            groupId, feedId, name, description, type, structureId, templateId,
131                            rendererTemplateId, delta, orderByCol, orderByType,
132                            targetLayoutFriendlyUrl, targetPortletId, contentField, feedType,
133                            feedVersion, serviceContext);
134            }
135    
136    }