1
14
15 package com.liferay.portlet.blogs.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.blogs.asset.BlogsEntryAssetRenderer;
26 import com.liferay.portlet.blogs.model.BlogsEntry;
27 import com.liferay.portlet.blogs.service.BlogsEntryLocalServiceUtil;
28
29 import java.io.Serializable;
30
31 import java.util.Map;
32
33
38 public class BlogsEntryWorkflowHandler extends BaseWorkflowHandler {
39
40 public static final String CLASS_NAME = BlogsEntry.class.getName();
41
42 public String getClassName() {
43 return CLASS_NAME;
44 }
45
46 public String getType() {
47 return TYPE_CONTENT;
48 }
49
50 public BlogsEntry updateStatus(
51 int status, Map<String, Serializable> workflowContext)
52 throws PortalException, SystemException {
53
54 long userId = GetterUtil.getLong(
55 (String)workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
56 long classPK = GetterUtil.getLong(
57 (String)workflowContext.get(
58 WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
59
60 ServiceContext serviceContext = (ServiceContext)workflowContext.get(
61 "serviceContext");
62
63 return BlogsEntryLocalServiceUtil.updateStatus(
64 userId, classPK, status, serviceContext);
65 }
66
67 protected AssetRenderer getAssetRenderer(long classPK)
68 throws PortalException, SystemException {
69
70 BlogsEntry entry = BlogsEntryLocalServiceUtil.getEntry(classPK);
71
72 return new BlogsEntryAssetRenderer(entry);
73 }
74
75 protected String getIconPath(ThemeDisplay themeDisplay) {
76 return themeDisplay.getPathThemeImages() + "/common/page.png";
77 }
78
79 }