001    /**
002     * Copyright (c) 2000-2010 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            public JournalFeed addFeed(
032                            long groupId, String feedId, boolean autoFeedId, String name,
033                            String description, String type, String structureId,
034                            String templateId, String rendererTemplateId, int delta,
035                            String orderByCol, String orderByType,
036                            String targetLayoutFriendlyUrl, String targetPortletId,
037                            String contentField, String feedType, double feedVersion,
038                            ServiceContext serviceContext)
039                    throws PortalException, SystemException {
040    
041                    JournalPermission.check(
042                            getPermissionChecker(), groupId, ActionKeys.ADD_FEED);
043    
044                    return journalFeedLocalService.addFeed(
045                            getUserId(), groupId, feedId, autoFeedId, name, description, type,
046                            structureId, templateId, rendererTemplateId, delta, orderByCol,
047                            orderByType, targetLayoutFriendlyUrl, targetPortletId, contentField,
048                            feedType, feedVersion, serviceContext);
049            }
050    
051            public void deleteFeed(long groupId, long feedId)
052                    throws PortalException, SystemException {
053    
054                    JournalFeedPermission.check(
055                            getPermissionChecker(), feedId, ActionKeys.DELETE);
056    
057                    journalFeedLocalService.deleteFeed(feedId);
058            }
059    
060            public void deleteFeed(long groupId, String feedId)
061                    throws PortalException, SystemException {
062    
063                    JournalFeedPermission.check(
064                            getPermissionChecker(), groupId, feedId, ActionKeys.DELETE);
065    
066                    journalFeedLocalService.deleteFeed(groupId, feedId);
067            }
068    
069            public JournalFeed getFeed(long groupId, long feedId)
070                    throws PortalException, SystemException {
071    
072                    JournalFeedPermission.check(
073                            getPermissionChecker(), feedId, ActionKeys.VIEW);
074    
075                    return journalFeedLocalService.getFeed(feedId);
076            }
077    
078            public JournalFeed getFeed(long groupId, String feedId)
079                    throws PortalException, SystemException {
080    
081                    JournalFeedPermission.check(
082                            getPermissionChecker(), groupId, feedId, ActionKeys.VIEW);
083    
084                    return journalFeedLocalService.getFeed(groupId, feedId);
085            }
086    
087            public JournalFeed updateFeed(
088                            long groupId, String feedId, String name, String description,
089                            String type, String structureId, String templateId,
090                            String rendererTemplateId, int delta, String orderByCol,
091                            String orderByType, String targetLayoutFriendlyUrl,
092                            String targetPortletId, String contentField, String feedType,
093                            double feedVersion, ServiceContext serviceContext)
094                    throws PortalException, SystemException {
095    
096                    JournalFeedPermission.check(
097                            getPermissionChecker(), groupId, feedId, ActionKeys.UPDATE);
098    
099                    return journalFeedLocalService.updateFeed(
100                            groupId, feedId, name, description, type, structureId, templateId,
101                            rendererTemplateId, delta, orderByCol, orderByType,
102                            targetLayoutFriendlyUrl, targetPortletId, contentField, feedType,
103                            feedVersion, serviceContext);
104            }
105    
106    }