Search in sources :

Example 1 with ElementDTO

use of org.apache.inlong.manager.common.pojo.workflow.ElementDTO in project incubator-inlong by apache.

the class WorkflowQueryServiceImpl method getBriefFromProcessEntity.

private WorkflowBriefDTO getBriefFromProcessEntity(WorkflowProcessEntity processEntity) {
    WorkflowProcess process = definitionRepository.get(processEntity.getName());
    if (process == null) {
        return null;
    }
    Map<String, TaskStatus> nameStatusMap = this.getTaskNameStatusMap(processEntity);
    ElementDTO elementDTO = new ElementDTO();
    StartEvent startEvent = process.getStartEvent();
    elementDTO.setName(startEvent.getName());
    elementDTO.setDisplayName(startEvent.getDisplayName());
    WorkflowContext context = WorkflowBeanUtils.buildContext(process, processEntity);
    addNext(startEvent, elementDTO, context, nameStatusMap);
    WorkflowBriefDTO briefDTO = new WorkflowBriefDTO();
    briefDTO.setName(process.getName());
    briefDTO.setDisplayName(process.getDisplayName());
    briefDTO.setType(process.getType());
    briefDTO.setStartEvent(elementDTO);
    return briefDTO;
}
Also used : WorkflowBriefDTO(org.apache.inlong.manager.common.pojo.workflow.WorkflowBriefDTO) ElementDTO(org.apache.inlong.manager.common.pojo.workflow.ElementDTO) WorkflowContext(org.apache.inlong.manager.workflow.WorkflowContext) StartEvent(org.apache.inlong.manager.workflow.definition.StartEvent) TaskStatus(org.apache.inlong.manager.common.enums.TaskStatus) WorkflowProcess(org.apache.inlong.manager.workflow.definition.WorkflowProcess)

Example 2 with ElementDTO

use of org.apache.inlong.manager.common.pojo.workflow.ElementDTO in project incubator-inlong by apache.

the class WorkflowQueryServiceImpl method addNext.

private void addNext(NextableElement nextableElement, ElementDTO elementDTO, WorkflowContext context, Map<String, TaskStatus> nameToStatusMap) {
    for (Element element : nextableElement.getNextList(context)) {
        ElementDTO nextElement = new ElementDTO();
        nextElement.setName(element.getName());
        nextElement.setDisplayName(element.getDisplayName());
        if (element instanceof UserTask) {
            nextElement.setApprovers(((UserTask) element).getApproverAssign().assign(context));
            nextElement.setStatus(nameToStatusMap.get(element.getName()));
        }
        elementDTO.getNext().add(nextElement);
        if (!(element instanceof NextableElement)) {
            continue;
        }
        addNext((NextableElement) element, nextElement, context, nameToStatusMap);
    }
}
Also used : NextableElement(org.apache.inlong.manager.workflow.definition.NextableElement) ElementDTO(org.apache.inlong.manager.common.pojo.workflow.ElementDTO) Element(org.apache.inlong.manager.workflow.definition.Element) NextableElement(org.apache.inlong.manager.workflow.definition.NextableElement) UserTask(org.apache.inlong.manager.workflow.definition.UserTask)

Aggregations

ElementDTO (org.apache.inlong.manager.common.pojo.workflow.ElementDTO)2 TaskStatus (org.apache.inlong.manager.common.enums.TaskStatus)1 WorkflowBriefDTO (org.apache.inlong.manager.common.pojo.workflow.WorkflowBriefDTO)1 WorkflowContext (org.apache.inlong.manager.workflow.WorkflowContext)1 Element (org.apache.inlong.manager.workflow.definition.Element)1 NextableElement (org.apache.inlong.manager.workflow.definition.NextableElement)1 StartEvent (org.apache.inlong.manager.workflow.definition.StartEvent)1 UserTask (org.apache.inlong.manager.workflow.definition.UserTask)1 WorkflowProcess (org.apache.inlong.manager.workflow.definition.WorkflowProcess)1