001    /**
002     * Copyright (c) 2000-2010 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.asset.model;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.portlet.LiferayPortletRequest;
020    import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
021    import com.liferay.portal.kernel.util.WebKeys;
022    import com.liferay.portal.theme.ThemeDisplay;
023    
024    import javax.portlet.PortletRequest;
025    import javax.portlet.PortletURL;
026    
027    /**
028     * @author Jorge Ferrer
029     * @author Juan Fernández
030     */
031    public abstract class BaseAssetRendererFactory implements AssetRendererFactory {
032    
033            public AssetRenderer getAssetRenderer(long classPK)
034                    throws PortalException, SystemException {
035    
036                    return getAssetRenderer(classPK, TYPE_LATEST_APPROVED);
037            }
038    
039            @SuppressWarnings("unused")
040            public AssetRenderer getAssetRenderer(long groupId, String urlTitle)
041                    throws PortalException, SystemException {
042    
043                    return null;
044            }
045    
046            public long getClassNameId() {
047                    return _classNameId;
048            }
049    
050            public String getIconPath(PortletRequest portletRequest) {
051                    ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(
052                            WebKeys.THEME_DISPLAY);
053    
054                    return getIconPath(themeDisplay);
055            }
056    
057            public String getPortletId() {
058                    return _portletId;
059            }
060    
061            public PortletURL getURLAdd(
062                    LiferayPortletRequest liferayPortletRequest,
063                    LiferayPortletResponse liferayPortletResponse) {
064    
065                    return null;
066            }
067    
068            public boolean isSelectable() {
069                    return true;
070            }
071    
072            public void setClassNameId(long classNameId) {
073                    _classNameId = classNameId;
074            }
075    
076            public void setPortletId(String portletId) {
077                    _portletId = portletId;
078            }
079    
080            protected String getIconPath(ThemeDisplay themeDisplay) {
081                    return themeDisplay.getPathThemeImages() + "/common/page.png";
082            }
083    
084            private long _classNameId;
085            private String _portletId;
086    
087    }