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