001    /**
002     * Copyright (c) 2000-2011 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.portal.service.impl;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.model.LayoutSet;
020    import com.liferay.portal.model.Plugin;
021    import com.liferay.portal.security.permission.ActionKeys;
022    import com.liferay.portal.service.base.LayoutSetServiceBaseImpl;
023    import com.liferay.portal.service.permission.GroupPermissionUtil;
024    
025    import java.io.InputStream;
026    
027    /**
028     * @author Brian Wing Shun Chan
029     */
030    public class LayoutSetServiceImpl extends LayoutSetServiceBaseImpl {
031    
032            public void updateLayoutSetPrototypeLinkEnabled(
033                            long groupId, boolean privateLayout,
034                            boolean layoutSetPrototypeLinkEnabled)
035                    throws PortalException, SystemException {
036    
037                    layoutSetLocalService.updateLayoutSetPrototypeLinkEnabled(
038                            groupId, privateLayout, layoutSetPrototypeLinkEnabled);
039            }
040            public void updateLogo(
041                            long groupId, boolean privateLayout, boolean logo,
042                            InputStream inputStream)
043                    throws PortalException, SystemException {
044    
045                    updateLogo(groupId, privateLayout, logo, inputStream, true);
046            }
047    
048            public void updateLogo(
049                            long groupId, boolean privateLayout, boolean logo,
050                            InputStream inputStream, boolean cleanUpStream)
051                    throws PortalException, SystemException {
052    
053                    GroupPermissionUtil.check(
054                            getPermissionChecker(), groupId, ActionKeys.UPDATE);
055    
056                    layoutSetLocalService.updateLogo(
057                            groupId, privateLayout, logo, inputStream, cleanUpStream);
058            }
059    
060            public LayoutSet updateLookAndFeel(
061                            long groupId, boolean privateLayout, String themeId,
062                            String colorSchemeId, String css, boolean wapTheme)
063                    throws PortalException, SystemException {
064    
065                    GroupPermissionUtil.check(
066                            getPermissionChecker(), groupId, ActionKeys.UPDATE);
067    
068                    pluginSettingLocalService.checkPermission(
069                            getUserId(), themeId, Plugin.TYPE_THEME);
070    
071                    return layoutSetLocalService.updateLookAndFeel(
072                            groupId, privateLayout, themeId, colorSchemeId, css, wapTheme);
073            }
074    
075            public LayoutSet updateSettings(
076                            long groupId, boolean privateLayout, String settings)
077                    throws PortalException, SystemException {
078    
079                    GroupPermissionUtil.check(
080                            getPermissionChecker(), groupId, ActionKeys.UPDATE);
081    
082                    return layoutSetLocalService.updateSettings(
083                            groupId, privateLayout, settings);
084            }
085    
086            public LayoutSet updateVirtualHost(
087                            long groupId, boolean privateLayout, String virtualHost)
088                    throws PortalException, SystemException {
089    
090                    GroupPermissionUtil.check(
091                            getPermissionChecker(), groupId, ActionKeys.UPDATE);
092    
093                    return layoutSetLocalService.updateVirtualHost(
094                            groupId, privateLayout, virtualHost);
095            }
096    
097    }