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

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

Introduction

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

Prototype

public static WorkflowTask completeWorkflowTask(long companyId, long userId, long workflowTaskId,
            String transitionName, String comment, 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  ww w . j av  a2 s . c  o m
}

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

License:Open Source License

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

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

    String transitionName = ParamUtil.getString(actionRequest, "transitionName");
    String comment = ParamUtil.getString(actionRequest, "comment");

    WorkflowTaskManagerUtil.completeWorkflowTask(themeDisplay.getCompanyId(), themeDisplay.getUserId(),
            workflowTaskId, transitionName, comment, null);
}