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.security.permission.ActionKeys;
020    import com.liferay.portal.service.ServiceContext;
021    import com.liferay.portlet.journal.model.JournalFeed;
022    import com.liferay.portlet.journal.service.base.JournalFeedServiceBaseImpl;
023    import com.liferay.portlet.journal.service.permission.JournalFeedPermission;
024    import com.liferay.portlet.journal.service.permission.JournalPermission;
025    
026    /**
027     * @author Raymond Aug??
028     */
029    public class JournalFeedServiceImpl extends JournalFeedServiceBaseImpl {
030    
031            @Override
032            public JournalFeed addFeed(
033                            long groupId, String feedId, boolean autoFeedId, String name,
034                            String description, String type, String structureId,
035                            String templateId, String rendererTemplateId, int delta,
036                            String orderByCol, String orderByType,
037                            String targetLayoutFriendlyUrl, String targetPortletId,
038                            String contentField, String feedType, double feedVersion,
039                            ServiceContext serviceContext)
040                    throws PortalException, SystemException {
041    
042                    JournalPermission.check(
043                            getPermissionChecker(), groupId, ActionKeys.ADD_FEED);
044    
045                    return journalFeedLocalService.addFeed(
046                            getUserId(), groupId, feedId, autoFeedId, name, description, type,
047                            structureId, templateId, rendererTemplateId, delta, orderByCol,
048                            orderByType, targetLayoutFriendlyUrl, targetPortletId, contentField,
049                            feedType, feedVersion, serviceContext);
050            }
051    
052            @Override
053            public void deleteFeed(long groupId, long feedId)
054                    throws PortalException, SystemException {
055    
056                    JournalFeedPermission.check(
057                            getPermissionChecker(), feedId, ActionKeys.DELETE);
058    
059                    journalFeedLocalService.deleteFeed(feedId);
060            }
061    
062            @Override
063            public void deleteFeed(long groupId, String feedId)
064                    throws PortalException, SystemException {
065    
066                    JournalFeedPermission.check(
067                            getPermissionChecker(), groupId, feedId, ActionKeys.DELETE);
068    
069                    journalFeedLocalService.deleteFeed(groupId, feedId);
070            }
071    
072            @Override
073            public JournalFeed getFeed(long groupId, long feedId)
074                    throws PortalException, SystemException {
075    
076                    JournalFeedPermission.check(
077                            getPermissionChecker(), feedId, ActionKeys.VIEW);
078    
079                    return journalFeedLocalService.getFeed(feedId);
080            }
081    
082            @Override
083            public JournalFeed getFeed(long groupId, String feedId)
084                    throws PortalException, SystemException {
085    
086                    JournalFeedPermission.check(
087                            getPermissionChecker(), groupId, feedId, ActionKeys.VIEW);
088    
089                    return journalFeedLocalService.getFeed(groupId, feedId);
090            }
091    
092            @Override
093            public JournalFeed updateFeed(
094                            long groupId, String feedId, String name, String description,
095                            String type, String structureId, String templateId,
096                            String rendererTemplateId, int delta, String orderByCol,
097                            String orderByType, String targetLayoutFriendlyUrl,
098                            String targetPortletId, String contentField, String feedType,
099                            double feedVersion, ServiceContext serviceContext)
100                    throws PortalException, SystemException {
101    
102                    JournalFeedPermission.check(
103                            getPermissionChecker(), groupId, feedId, ActionKeys.UPDATE);
104    
105                    return journalFeedLocalService.updateFeed(
106                            groupId, feedId, name, description, type, structureId, templateId,
107                            rendererTemplateId, delta, orderByCol, orderByType,
108                            targetLayoutFriendlyUrl, targetPortletId, contentField, feedType,
109                            feedVersion, serviceContext);
110            }
111    
112    }