001
014
015 package com.liferay.portlet.messageboards.trash;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.trash.BaseTrashRenderer;
020 import com.liferay.portal.kernel.util.HtmlUtil;
021 import com.liferay.portal.theme.ThemeDisplay;
022 import com.liferay.portal.util.PortletKeys;
023 import com.liferay.portal.util.WebKeys;
024 import com.liferay.portlet.asset.model.AssetRenderer;
025 import com.liferay.portlet.messageboards.model.MBMessage;
026 import com.liferay.portlet.messageboards.model.MBThread;
027 import com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil;
028
029 import java.util.Locale;
030
031 import javax.portlet.RenderRequest;
032 import javax.portlet.RenderResponse;
033
034
037 public class MBThreadTrashRenderer extends BaseTrashRenderer {
038
039 public static final String TYPE = "message_thread";
040
041 public MBThreadTrashRenderer(MBThread thread)
042 throws PortalException, SystemException {
043
044 _rootMessage = MBMessageLocalServiceUtil.getMBMessage(
045 thread.getRootMessageId());
046 }
047
048 @Override
049 public String getIconPath(ThemeDisplay themeDisplay) {
050 return themeDisplay.getPathThemeImages() + "/common/conversation.png";
051 }
052
053 public String getPortletId() {
054 return PortletKeys.MESSAGE_BOARDS;
055 }
056
057 public String getSummary(Locale locale) {
058 return null;
059 }
060
061 public String getTitle(Locale locale) {
062 return HtmlUtil.stripHtml(_rootMessage.getSubject());
063 }
064
065 public String getType() {
066 return TYPE;
067 }
068
069 public String render(
070 RenderRequest renderRequest, RenderResponse renderResponse,
071 String template)
072 throws Exception {
073
074 if (template.equals(AssetRenderer.TEMPLATE_ABSTRACT) ||
075 template.equals(AssetRenderer.TEMPLATE_FULL_CONTENT)) {
076
077 renderRequest.setAttribute(
078 WebKeys.MESSAGE_BOARDS_MESSAGE, _rootMessage);
079
080 return "/html/portlet/message_boards/asset/" + template + ".jsp";
081 }
082
083 return null;
084 }
085
086 private MBMessage _rootMessage;
087
088 }