Example usage for com.liferay.portal.kernel.workflow WorkflowTaskManagerUtil assignWorkflowTaskToUser

List of usage examples for com.liferay.portal.kernel.workflow WorkflowTaskManagerUtil assignWorkflowTaskToUser

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.workflow WorkflowTaskManagerUtil assignWorkflowTaskToUser.

Prototype

public static WorkflowTask assignWorkflowTaskToUser(long companyId, long userId, long workflowTaskId,
            long assigneeUserId, String comment, Date dueDate, Map<String, Serializable> workflowContext)
            throws WorkflowException 

Source Link

Usage

From source file:com.liferay.calendar.test.util.CalendarWorkflowTestUtil.java

License:Open Source License

public static void completeWorkflow(Group group) throws Exception {
    try (CaptureAppender captureAppender = Log4JLoggerTestUtil
            .configureLog4JLogger("com.liferay.util.mail.MailEngine", Level.OFF)) {

        List<WorkflowTask> workflowTasks = WorkflowTaskManagerUtil.getWorkflowTasksByUserRoles(
                TestPropsValues.getCompanyId(), TestPropsValues.getUserId(), false, QueryUtil.ALL_POS,
                QueryUtil.ALL_POS, null);

        Assert.assertEquals(workflowTasks.toString(), 1, workflowTasks.size());

        WorkflowTask workflowTask = workflowTasks.get(0);

        PermissionChecker userPermissionChecker = PermissionCheckerFactoryUtil
                .create(TestPropsValues.getUser());

        PermissionThreadLocal.setPermissionChecker(userPermissionChecker);

        WorkflowTaskManagerUtil.assignWorkflowTaskToUser(group.getCompanyId(), TestPropsValues.getUserId(),
                workflowTask.getWorkflowTaskId(), TestPropsValues.getUserId(), StringPool.BLANK, null, null);

        WorkflowTaskManagerUtil.completeWorkflowTask(group.getCompanyId(), TestPropsValues.getUserId(),
                workflowTask.getWorkflowTaskId(), Constants.APPROVE, StringPool.BLANK, null);
    }/*from  w ww .j a va 2  s.c o  m*/
}

From source file:com.liferay.portlet.workflowtasks.action.EditWorkflowTaskAction.java

License:Open Source License

protected void assignTask(ActionRequest actionRequest) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId");

    long assigneeUserId = ParamUtil.getLong(actionRequest, "assigneeUserId");
    String comment = ParamUtil.getString(actionRequest, "comment");

    WorkflowTaskManagerUtil.assignWorkflowTaskToUser(themeDisplay.getCompanyId(), themeDisplay.getUserId(),
            workflowTaskId, assigneeUserId, comment, null, null);
}