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.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    }