001
014
015 package com.liferay.portlet.messageboards.asset;
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.security.permission.PermissionChecker;
022 import com.liferay.portal.theme.ThemeDisplay;
023 import com.liferay.portlet.asset.model.AssetRenderer;
024 import com.liferay.portlet.asset.model.BaseAssetRendererFactory;
025 import com.liferay.portlet.messageboards.model.MBMessage;
026 import com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil;
027 import com.liferay.portlet.messageboards.service.permission.MBMessagePermission;
028
029 import javax.portlet.PortletURL;
030
031
036 public class MBMessageAssetRendererFactory extends BaseAssetRendererFactory {
037
038 public static final String CLASS_NAME = MBMessage.class.getName();
039
040 public static final String TYPE = "message";
041
042 public AssetRenderer getAssetRenderer(long classPK, int type)
043 throws PortalException, SystemException {
044
045 MBMessage message = MBMessageLocalServiceUtil.getMessage(classPK);
046
047 return new MBMessageAssetRenderer(message);
048 }
049
050 public String getClassName() {
051 return CLASS_NAME;
052 }
053
054 public String getType() {
055 return TYPE;
056 }
057
058 public PortletURL getURLAdd(
059 LiferayPortletRequest liferayPortletRequest,
060 LiferayPortletResponse liferayPortletResponse) {
061
062 return null;
063 }
064
065 public boolean hasPermission(
066 PermissionChecker permissionChecker, long classPK, String actionId)
067 throws Exception {
068
069 return MBMessagePermission.contains(
070 permissionChecker, classPK, actionId);
071 }
072
073 protected String getIconPath(ThemeDisplay themeDisplay) {
074 return themeDisplay.getPathThemeImages() + "/common/conversation.png";
075 }
076
077 }