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