我在工作流的最后一步有两个名为“已批准”和“拒绝”的转换,但我想从我的 portlet 控制工作流操作。
有人知道如何在 liferay 中以编程方式执行工作流转换吗?
我在工作流的最后一步有两个名为“已批准”和“拒绝”的转换,但我想从我的 portlet 控制工作流操作。
有人知道如何在 liferay 中以编程方式执行工作流转换吗?
我当前的代码
JournalArticle journalArticle = JournalArticleLocalServiceUtil.getArticle(id);
getPermissionChecker().init(u.getUser(), true);
WorkflowInstanceLink wil= WorkflowInstanceLinkLocalServiceUtil.getWorkflowInstanceLink(companyId, journalArticle.getGroupId(), JournalArticle.class.getName(), journalArticle.getId());
WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(companyId, wil.getWorkflowInstanceId());
Map<String, Serializable> workflowContext = workflowInstance.getWorkflowContext();
List<Integer> logTypes_assign = new ArrayList<Integer>();
logTypes_assign.add(WorkflowLog.TASK_ASSIGN);
List<WorkflowLog> workflowLogs_assign = WorkflowLogManagerUtil.getWorkflowLogsByWorkflowInstance(companyId, wil.getWorkflowInstanceId(), logTypes_assign, QueryUtil.ALL_POS, QueryUtil.ALL_POS, WorkflowComparatorFactoryUtil.getLogCreateDateComparator(true));
//WorkflowPermissionUtil.hasPermission(permissionChecker, groupId, className, classPK, actionId);
if(workflowLogs_assign.size() > 0){
long taskId = workflowLogs_assign.get(workflowLogs_assign.size()-1).getWorkflowTaskId();
WorkflowTask task = WorkflowTaskManagerUtil.getWorkflowTask(companyId, taskId);
_log.info("task : "+task.getName());
WorkflowTask nextTask = WorkflowTaskManagerUtil.assignWorkflowTaskToUser(companyId, userId, task.getWorkflowTaskId(), userId, "auto assign", task.getDueDate(), workflowContext);
WorkflowTaskManagerUtil.completeWorkflowTask(companyId, userId, nextTask.getWorkflowTaskId(), "next task transition name", "next task name", workflowContext);
}
workflowInstance1 = WorkflowInstanceManagerUtil.signalWorkflowInstance(service.getCompanyId(), user.getUserId(),
workflowInstanceId, transitionNAME, workflowInstance.getWorkflowContext());