001    /**
002     * Copyright (c) 2000-2010 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.File;
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, File file)
034                    throws PortalException, SystemException {
035    
036                    GroupPermissionUtil.check(
037                            getPermissionChecker(), groupId, ActionKeys.MANAGE_LAYOUTS);
038    
039                    layoutSetLocalService.updateLogo(groupId, privateLayout, logo, file);
040            }
041    
042            public LayoutSet updateLookAndFeel(
043                            long groupId, boolean privateLayout, String themeId,
044                            String colorSchemeId, String css, boolean wapTheme)
045                    throws PortalException, SystemException {
046    
047                    GroupPermissionUtil.check(
048                            getPermissionChecker(), groupId, ActionKeys.MANAGE_LAYOUTS);
049    
050                    pluginSettingLocalService.checkPermission(
051                            getUserId(), themeId, Plugin.TYPE_THEME);
052    
053                    return layoutSetLocalService.updateLookAndFeel(
054                            groupId, privateLayout, themeId, colorSchemeId, css, wapTheme);
055            }
056    
057            public LayoutSet updateSettings(
058                            long groupId, boolean privateLayout, String settings)
059                    throws PortalException, SystemException {
060    
061                    GroupPermissionUtil.check(
062                            getPermissionChecker(), groupId, ActionKeys.MANAGE_LAYOUTS);
063    
064                    return layoutSetLocalService.updateSettings(
065                            groupId, privateLayout, settings);
066            }
067    
068            public LayoutSet updateVirtualHost(
069                            long groupId, boolean privateLayout, String virtualHost)
070                    throws PortalException, SystemException {
071    
072                    GroupPermissionUtil.check(
073                            getPermissionChecker(), groupId, ActionKeys.UPDATE);
074    
075                    return layoutSetLocalService.updateVirtualHost(
076                            groupId, privateLayout, virtualHost);
077            }
078    
079    }