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