001
014
015 package com.liferay.portlet.messageboards.workflow;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.GetterUtil;
020 import com.liferay.portal.kernel.workflow.BaseWorkflowHandler;
021 import com.liferay.portal.kernel.workflow.WorkflowConstants;
022 import com.liferay.portal.security.permission.ResourceActionsUtil;
023 import com.liferay.portal.service.ServiceContext;
024 import com.liferay.portal.theme.ThemeDisplay;
025 import com.liferay.portlet.messageboards.model.MBMessage;
026 import com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil;
027
028 import java.io.Serializable;
029
030 import java.util.Locale;
031 import java.util.Map;
032
033
038 public class MBMessageWorkflowHandler extends BaseWorkflowHandler {
039
040 public static final String CLASS_NAME = MBMessage.class.getName();
041
042 public String getClassName() {
043 return CLASS_NAME;
044 }
045
046 public String getType(Locale locale) {
047 return ResourceActionsUtil.getModelResource(locale, CLASS_NAME);
048 }
049
050 public Object updateStatus(
051 int status, Map<String, Serializable> workflowContext)
052 throws PortalException, SystemException {
053
054 long userId = GetterUtil.getLong(
055 (String)workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
056 long classPK = GetterUtil.getLong(
057 (String)workflowContext.get(
058 WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
059
060 ServiceContext serviceContext = (ServiceContext)workflowContext.get(
061 "serviceContext");
062
063 return MBMessageLocalServiceUtil.updateStatus(
064 userId, classPK, status, serviceContext);
065 }
066
067 protected String getIconPath(ThemeDisplay themeDisplay) {
068 return themeDisplay.getPathThemeImages() + "/common/conversation.png";
069 }
070
071 }