001
014
015 package com.liferay.portlet.blogs.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.blogs.model.BlogsEntry;
025 import com.liferay.portlet.blogs.service.BlogsEntryLocalServiceUtil;
026
027 import java.io.Serializable;
028
029 import java.util.Locale;
030 import java.util.Map;
031
032
035 public class BlogsEntryWorkflowHandler extends BaseWorkflowHandler<BlogsEntry> {
036
037 @Override
038 public String getClassName() {
039 return BlogsEntry.class.getName();
040 }
041
042 @Override
043 public String getType(Locale locale) {
044 return ResourceActionsUtil.getModelResource(locale, getClassName());
045 }
046
047 @Override
048 public BlogsEntry updateStatus(
049 int status, Map<String, Serializable> workflowContext)
050 throws PortalException {
051
052 long userId = GetterUtil.getLong(
053 (String)workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
054 long classPK = GetterUtil.getLong(
055 (String)workflowContext.get(
056 WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
057
058 ServiceContext serviceContext = (ServiceContext)workflowContext.get(
059 "serviceContext");
060
061 return BlogsEntryLocalServiceUtil.updateStatus(
062 userId, classPK, status, serviceContext, workflowContext);
063 }
064
065 @Override
066 protected String getIconPath(ThemeDisplay themeDisplay) {
067 return themeDisplay.getPathThemeImages() + "/blogs/blogs.png";
068 }
069
070 }