1
14
15 package com.liferay.portlet.messageboards.workflow;
16
17 import com.liferay.portal.kernel.exception.PortalException;
18 import com.liferay.portal.kernel.exception.SystemException;
19 import com.liferay.portal.kernel.util.GetterUtil;
20 import com.liferay.portal.kernel.workflow.BaseWorkflowHandler;
21 import com.liferay.portal.kernel.workflow.WorkflowConstants;
22 import com.liferay.portal.service.ServiceContext;
23 import com.liferay.portal.theme.ThemeDisplay;
24 import com.liferay.portlet.asset.model.AssetRenderer;
25 import com.liferay.portlet.messageboards.asset.MBMessageAssetRenderer;
26 import com.liferay.portlet.messageboards.model.MBMessage;
27 import com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil;
28
29 import java.io.Serializable;
30
31 import java.util.Map;
32
33
39 public class MBMessageWorkflowHandler extends BaseWorkflowHandler {
40
41 public static final String CLASS_NAME = MBMessage.class.getName();
42
43 public String getClassName() {
44 return CLASS_NAME;
45 }
46
47 public String getType() {
48 return TYPE_CONTENT;
49 }
50
51 public Object updateStatus(
52 int status, Map<String, Serializable> workflowContext)
53 throws PortalException, SystemException {
54
55 long userId = GetterUtil.getLong(
56 (String)workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
57 long classPK = GetterUtil.getLong(
58 (String)workflowContext.get(
59 WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
60
61 ServiceContext serviceContext = (ServiceContext)workflowContext.get(
62 "serviceContext");
63
64 return MBMessageLocalServiceUtil.updateStatus(
65 userId, classPK, status, serviceContext);
66 }
67
68 protected AssetRenderer getAssetRenderer(long classPK)
69 throws PortalException, SystemException {
70
71 MBMessage message = MBMessageLocalServiceUtil.getMessage(classPK);
72
73 return new MBMessageAssetRenderer(message);
74 }
75
76 protected String getIconPath(ThemeDisplay themeDisplay) {
77 return themeDisplay.getPathThemeImages() + "/common/conversation.png";
78 }
79
80 }