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