Search in sources :

Example 6 with Task

use of org.flowable.engine.task.Task in project plumdo-work by wengwh.

the class TaskIdentityResource method createIdentityLink.

@RequestMapping(value = "/task/{taskId}/identity", method = RequestMethod.POST, name = "任务候选人创建")
@ResponseStatus(value = HttpStatus.OK)
public void createIdentityLink(@PathVariable("taskId") String taskId, @RequestBody TaskIdentityRequest taskIdentityRequest) {
    Task task = getTaskFromRequest(taskId, false);
    validateIdentityLinkArguments(taskIdentityRequest.getIdentityId(), taskIdentityRequest.getType());
    if (TaskIdentityRequest.AUTHORIZE_GROUP.equals(taskIdentityRequest.getType())) {
        taskService.addGroupIdentityLink(task.getId(), taskIdentityRequest.getIdentityId(), IdentityLinkType.CANDIDATE);
    } else if (TaskIdentityRequest.AUTHORIZE_USER.equals(taskIdentityRequest.getType())) {
        taskService.addUserIdentityLink(task.getId(), taskIdentityRequest.getIdentityId(), IdentityLinkType.CANDIDATE);
    }
}
Also used : Task(org.flowable.engine.task.Task) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with Task

use of org.flowable.engine.task.Task in project plumdo-work by wengwh.

the class TaskClaimResource method claimTask.

@RequestMapping(value = "/task/{taskId}/claim", method = RequestMethod.PUT, name = "任务认领")
@ResponseStatus(value = HttpStatus.OK)
public void claimTask(@PathVariable String taskId, @RequestBody(required = false) TaskActionRequest actionRequest) {
    Task task = getTaskFromRequest(taskId, false);
    taskService.claim(task.getId(), Authentication.getAuthenticatedUserId());
}
Also used : Task(org.flowable.engine.task.Task) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with Task

use of org.flowable.engine.task.Task in project plumdo-work by wengwh.

the class TaskHelpResource method helpTask.

@RequestMapping(value = "/task/{taskId}/help/{helper}", method = RequestMethod.PUT, name = "任务协办")
@ResponseStatus(value = HttpStatus.OK)
@Transactional(propagation = Propagation.REQUIRED)
public void helpTask(@PathVariable("taskId") String taskId, @PathVariable("helper") String helper, @RequestBody(required = false) TaskActionRequest actionRequest) {
    Task task = getTaskFromRequest(taskId);
    if (task.getAssignee() == null) {
        taskService.setAssignee(taskId, Authentication.getAuthenticatedUserId());
    }
    taskService.delegateTask(task.getId(), helper);
// taskExtService.setStartTime(task.getId());
}
Also used : Task(org.flowable.engine.task.Task) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) Transactional(org.springframework.transaction.annotation.Transactional)

Example 9 with Task

use of org.flowable.engine.task.Task in project plumdo-work by wengwh.

the class TaskAssignResource method assignTask.

@RequestMapping(value = "/task/{taskId}/assign/{assignee}", method = RequestMethod.PUT, name = "任务转办")
@ResponseStatus(value = HttpStatus.OK)
public void assignTask(@PathVariable("taskId") String taskId, @PathVariable("assignee") String assignee, @RequestBody(required = false) TaskActionRequest actionRequest) {
    Task task = getTaskFromRequest(taskId);
    taskService.setAssignee(task.getId(), assignee);
}
Also used : Task(org.flowable.engine.task.Task) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with Task

use of org.flowable.engine.task.Task in project plumdo-work by wengwh.

the class TaskIdentityResource method getIdentityLinks.

@RequestMapping(value = "/task/{taskId}/identity", method = RequestMethod.GET, produces = "application/json", name = "任务候选人查询")
public List<TaskIdentityResponse> getIdentityLinks(@PathVariable("taskId") String taskId) {
    Task task = getTaskFromRequest(taskId, false);
    List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(task.getId());
    return restResponseFactory.createTaskIdentityResponseList(identityLinks);
}
Also used : Task(org.flowable.engine.task.Task) IdentityLink(org.flowable.engine.task.IdentityLink) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Task (org.flowable.engine.task.Task)10 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)9 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)8 Transactional (org.springframework.transaction.annotation.Transactional)4 ArrayList (java.util.ArrayList)3 RestVariable (com.plumdo.flow.rest.variable.RestVariable)2 HashMap (java.util.HashMap)2 FlowableIllegalArgumentException (org.flowable.engine.common.api.FlowableIllegalArgumentException)2 ProcessInstanceStartResponse (com.plumdo.flow.rest.instance.ProcessInstanceStartResponse)1 MultiKey (com.plumdo.flow.rest.task.MultiKey)1 TaskCompleteResponse (com.plumdo.flow.rest.task.TaskCompleteResponse)1 TaskResponse (com.plumdo.flow.rest.task.TaskResponse)1 Map (java.util.Map)1 HistoricProcessInstance (org.flowable.engine.history.HistoricProcessInstance)1 ProcessInstance (org.flowable.engine.runtime.ProcessInstance)1 IdentityLink (org.flowable.engine.task.IdentityLink)1