Search in sources :

Example 1 with IdentityLink

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

the class RestResponseFactory method createTaskNextActorResponse.

public TaskNextActorResponse createTaskNextActorResponse(Task task, List<IdentityLink> identityLinks) {
    TaskNextActorResponse taskNextActor = new TaskNextActorResponse();
    taskNextActor.setProcessDefinitionId(task.getProcessDefinitionId());
    taskNextActor.setTaskDefinitionKey(task.getTaskDefinitionKey());
    taskNextActor.setTaskDefinitionName(task.getName());
    for (IdentityLink identityLink : identityLinks) {
        if (identityLink.getGroupId() != null) {
            taskNextActor.addActorInfo(identityLink.getGroupId(), TaskNextActorResponse.TYPE_GROUP, identityLink.getType());
        } else if (identityLink.getUserId() != null) {
            taskNextActor.addActorInfo(identityLink.getUserId(), TaskNextActorResponse.TYPE_USER, identityLink.getType());
        }
    }
    return taskNextActor;
}
Also used : TaskNextActorResponse(com.plumdo.flow.rest.task.TaskNextActorResponse) IdentityLink(org.flowable.engine.task.IdentityLink)

Example 2 with IdentityLink

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

the class ProcessDefinitionAuthorizeResource method getAuthorizes.

@RequestMapping(value = "/process-definition/{processDefinitionId}/authorize", method = RequestMethod.GET, produces = "application/json", name = "流程定义授权查询")
public ArrayNode getAuthorizes(@PathVariable String processDefinitionId) {
    ProcessDefinition processDefinition = getProcessDefinitionFromRequest(processDefinitionId);
    List<IdentityLink> identityLinks = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());
    ArrayNode arrayNode = objectMapper.createArrayNode();
    for (IdentityLink identityLink : identityLinks) {
        ObjectNode objectNode = objectMapper.createObjectNode();
        if (identityLink.getGroupId() != null) {
            objectNode.put("type", ProcessDefinitionAuthorizeRequest.AUTHORIZE_GROUP);
            objectNode.put("identityId", identityLink.getGroupId());
        } else if (identityLink.getUserId() != null) {
            objectNode.put("type", ProcessDefinitionAuthorizeRequest.AUTHORIZE_USER);
            objectNode.put("identityId", identityLink.getUserId());
        }
        arrayNode.add(objectNode);
    }
    return arrayNode;
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ProcessDefinition(org.flowable.engine.repository.ProcessDefinition) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) IdentityLink(org.flowable.engine.task.IdentityLink) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with IdentityLink

use of org.flowable.engine.task.IdentityLink 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

IdentityLink (org.flowable.engine.task.IdentityLink)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 TaskNextActorResponse (com.plumdo.flow.rest.task.TaskNextActorResponse)1 ProcessDefinition (org.flowable.engine.repository.ProcessDefinition)1 Task (org.flowable.engine.task.Task)1