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.layoutsadmin.trash;
016    
017    import com.liferay.portal.kernel.trash.BaseTrashRenderer;
018    import com.liferay.portal.model.ExportImportConfiguration;
019    import com.liferay.portal.theme.ThemeDisplay;
020    import com.liferay.portal.util.PortletKeys;
021    import com.liferay.portal.util.WebKeys;
022    
023    import java.util.Locale;
024    
025    import javax.portlet.PortletRequest;
026    import javax.portlet.PortletResponse;
027    import javax.portlet.RenderRequest;
028    import javax.portlet.RenderResponse;
029    
030    /**
031     * @author Levente Hud??k
032     */
033    public class ExportImportConfigurationTrashRenderer extends BaseTrashRenderer {
034    
035            public static final String TYPE = "export_import_configuration";
036    
037            public ExportImportConfigurationTrashRenderer(
038                    ExportImportConfiguration exportImportConfiguration) {
039    
040                    _exportImportConfiguration = exportImportConfiguration;
041            }
042    
043            @Override
044            public String getClassName() {
045                    return ExportImportConfiguration.class.getName();
046            }
047    
048            @Override
049            public long getClassPK() {
050                    return _exportImportConfiguration.getPrimaryKey();
051            }
052    
053            @Override
054            public String getIconPath(ThemeDisplay themeDisplay) {
055                    return themeDisplay.getPathThemeImages() + "/common/configuration.png";
056            }
057    
058            @Override
059            public String getPortletId() {
060                    return PortletKeys.LAYOUTS_ADMIN;
061            }
062    
063            @Override
064            public String getSummary(
065                    PortletRequest portletRequest, PortletResponse portletResponse) {
066    
067                    return _exportImportConfiguration.getDescription();
068            }
069    
070            @Override
071            public String getTitle(Locale locale) {
072                    return _exportImportConfiguration.getName();
073            }
074    
075            @Override
076            public String getType() {
077                    return TYPE;
078            }
079    
080            @Override
081            public String render(
082                            RenderRequest renderRequest, RenderResponse renderResponse,
083                            String template)
084                    throws Exception {
085    
086                    renderRequest.setAttribute(
087                            WebKeys.EXPORT_IMPORT_CONFIGURATION_ID,
088                            _exportImportConfiguration.getExportImportConfigurationId());
089    
090                    return "/html/portlet/layouts_admin/view_configuration.jsp";
091            }
092    
093            private final ExportImportConfiguration _exportImportConfiguration;
094    
095    }