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 @Override
040 public String getClassName() {
041 return WikiPage.class.getName();
042 }
043
044 @Override
045 public String getType(Locale locale) {
046 return ResourceActionsUtil.getModelResource(locale, getClassName());
047 }
048
049 @Override
050 public WikiPage 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 WikiPage page = WikiPageLocalServiceUtil.getPageByPageId(classPK);
064
065 return WikiPageLocalServiceUtil.updateStatus(
066 userId, page, status, serviceContext);
067 }
068
069 @Override
070 protected String getIconPath(ThemeDisplay themeDisplay) {
071 return themeDisplay.getPathThemeImages() + "/common/pages.png";
072 }
073
074 }