001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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 updateLogo(
033                            long groupId, boolean privateLayout, boolean logo,
034                            InputStream inputStream)
035                    throws PortalException, SystemException {
036    
037                    updateLogo(groupId, privateLayout, logo, inputStream, true);
038            }
039    
040            public void updateLogo(
041                            long groupId, boolean privateLayout, boolean logo,
042                            InputStream inputStream, boolean cleanUpStream)
043                    throws PortalException, SystemException {
044    
045                    GroupPermissionUtil.check(
046                            getPermissionChecker(), groupId, ActionKeys.UPDATE);
047    
048                    layoutSetLocalService.updateLogo(
049                            groupId, privateLayout, logo, inputStream, cleanUpStream);
050            }
051    
052            public LayoutSet updateLookAndFeel(
053                            long groupId, boolean privateLayout, String themeId,
054                            String colorSchemeId, String css, boolean wapTheme)
055                    throws PortalException, SystemException {
056    
057                    GroupPermissionUtil.check(
058                            getPermissionChecker(), groupId, ActionKeys.UPDATE);
059    
060                    pluginSettingLocalService.checkPermission(
061                            getUserId(), themeId, Plugin.TYPE_THEME);
062    
063                    return layoutSetLocalService.updateLookAndFeel(
064                            groupId, privateLayout, themeId, colorSchemeId, css, wapTheme);
065            }
066    
067            public LayoutSet updateSettings(
068                            long groupId, boolean privateLayout, String settings)
069                    throws PortalException, SystemException {
070    
071                    GroupPermissionUtil.check(
072                            getPermissionChecker(), groupId, ActionKeys.UPDATE);
073    
074                    return layoutSetLocalService.updateSettings(
075                            groupId, privateLayout, settings);
076            }
077    
078            public LayoutSet updateVirtualHost(
079                            long groupId, boolean privateLayout, String virtualHost)
080                    throws PortalException, SystemException {
081    
082                    GroupPermissionUtil.check(
083                            getPermissionChecker(), groupId, ActionKeys.UPDATE);
084    
085                    return layoutSetLocalService.updateVirtualHost(
086                            groupId, privateLayout, virtualHost);
087            }
088    
089    }