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.security.permission.PermissionChecker;
023    import com.liferay.portal.theme.ThemeDisplay;
024    
025    import javax.portlet.PortletRequest;
026    import javax.portlet.PortletURL;
027    
028    /**
029     * @author Jorge Ferrer
030     */
031    public abstract class BaseAssetRenderer implements AssetRenderer {
032    
033            public String[] getAvailableLocales() {
034                    return _EMPTY_ARRAY;
035            }
036    
037            public String getDiscussionPath() {
038                    return null;
039            }
040    
041            public String getIconPath(PortletRequest portletRequest) {
042                    ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(
043                            WebKeys.THEME_DISPLAY);
044    
045                    return getIconPath(themeDisplay);
046            }
047    
048            public PortletURL getURLEdit(
049                            LiferayPortletRequest liferayPortletRequest,
050                            LiferayPortletResponse liferayPortletResponse)
051                    throws Exception {
052    
053                    return null;
054            }
055    
056            public PortletURL getURLExport(
057                            LiferayPortletRequest liferayPortletRequest,
058                            LiferayPortletResponse liferayPortletResponse)
059                    throws Exception {
060    
061                    return null;
062            }
063    
064            public String getUrlTitle() {
065                    return null;
066            }
067    
068            public String getURLViewInContext(
069                            LiferayPortletRequest liferayPortletRequest,
070                            LiferayPortletResponse liferayPortletResponse,
071                            String noSuchEntryRedirect)
072                    throws Exception {
073    
074                    return null;
075            }
076    
077            public String getViewInContextMessage() {
078                    return "view-in-context";
079            }
080    
081            /**
082             * @throws PortalException
083             * @throws SystemException
084             */
085            public boolean hasEditPermission(PermissionChecker permissionChecker)
086                    throws PortalException, SystemException {
087    
088                    return false;
089            }
090    
091            /**
092             * @throws PortalException
093             * @throws SystemException
094             */
095            public boolean hasViewPermission(PermissionChecker permissionChecker)
096                    throws PortalException, SystemException {
097    
098                    return true;
099            }
100    
101            public boolean isConvertible() {
102                    return false;
103            }
104    
105            public boolean isLocalizable() {
106                    return false;
107            }
108    
109            public boolean isPrintable() {
110                    return false;
111            }
112    
113            protected String getIconPath(ThemeDisplay themeDisplay) {
114                    return themeDisplay.getPathThemeImages() + "/common/page.png";
115            }
116    
117            private static final String[] _EMPTY_ARRAY = new String[0];
118    
119    }