001    /**
002     * Copyright (c) 2000-present 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.exportimport.service.impl;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.security.permission.ActionKeys;
019    import com.liferay.portal.service.permission.GroupPermissionUtil;
020    import com.liferay.portlet.exportimport.model.ExportImportConfiguration;
021    import com.liferay.portlet.exportimport.service.base.ExportImportConfigurationServiceBaseImpl;
022    
023    /**
024     * @author Brian Wing Shun Chan
025     * @author Levente Hud??k
026     */
027    public class ExportImportConfigurationServiceImpl
028            extends ExportImportConfigurationServiceBaseImpl {
029    
030            @Override
031            public void deleteExportImportConfiguration(
032                            long exportImportConfigurationId)
033                    throws PortalException {
034    
035                    ExportImportConfiguration exportImportConfiguration =
036                            exportImportConfigurationLocalService.getExportImportConfiguration(
037                                    exportImportConfigurationId);
038    
039                    GroupPermissionUtil.check(
040                            getPermissionChecker(), exportImportConfiguration.getGroupId(),
041                            ActionKeys.DELETE);
042    
043                    exportImportConfigurationLocalService.deleteExportImportConfiguration(
044                            exportImportConfiguration);
045            }
046    
047            @Override
048            public ExportImportConfiguration moveExportImportConfigurationToTrash(
049                            long exportImportConfigurationId)
050                    throws PortalException {
051    
052                    ExportImportConfiguration exportImportConfiguration =
053                            exportImportConfigurationLocalService.getExportImportConfiguration(
054                                    exportImportConfigurationId);
055    
056                    GroupPermissionUtil.check(
057                            getPermissionChecker(), exportImportConfiguration.getGroupId(),
058                            ActionKeys.DELETE);
059    
060                    return exportImportConfigurationLocalService.
061                            moveExportImportConfigurationToTrash(
062                                    getUserId(), exportImportConfigurationId);
063            }
064    
065            @Override
066            public ExportImportConfiguration restoreExportImportConfigurationFromTrash(
067                            long exportImportConfigurationId)
068                    throws PortalException {
069    
070                    ExportImportConfiguration exportImportConfiguration =
071                            exportImportConfigurationLocalService.getExportImportConfiguration(
072                                    exportImportConfigurationId);
073    
074                    GroupPermissionUtil.check(
075                            getPermissionChecker(), exportImportConfiguration.getGroupId(),
076                            ActionKeys.DELETE);
077    
078                    return exportImportConfigurationLocalService.
079                            restoreExportImportConfigurationFromTrash(
080                                    getUserId(), exportImportConfigurationId);
081            }
082    
083    }