001
014
015 package com.liferay.portlet.messageboards.workflow;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.util.GetterUtil;
019 import com.liferay.portal.kernel.workflow.BaseWorkflowHandler;
020 import com.liferay.portal.kernel.workflow.WorkflowConstants;
021 import com.liferay.portal.security.permission.ResourceActionsUtil;
022 import com.liferay.portal.service.ServiceContext;
023 import com.liferay.portal.theme.ThemeDisplay;
024 import com.liferay.portlet.messageboards.model.MBMessage;
025 import com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil;
026
027 import java.io.Serializable;
028
029 import java.util.Locale;
030 import java.util.Map;
031
032
037 public class MBMessageWorkflowHandler extends BaseWorkflowHandler<MBMessage> {
038
039 @Override
040 public String getClassName() {
041 return MBMessage.class.getName();
042 }
043
044 @Override
045 public String getType(Locale locale) {
046 return ResourceActionsUtil.getModelResource(locale, getClassName());
047 }
048
049 @Override
050 public MBMessage updateStatus(
051 int status, Map<String, Serializable> workflowContext)
052 throws PortalException {
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, workflowContext);
065 }
066
067 @Override
068 protected String getIconPath(ThemeDisplay themeDisplay) {
069 return themeDisplay.getPathThemeImages() + "/common/conversation.png";
070 }
071
072 }