Search in sources :

Example 1 with CalledProcessInstanceDto

use of io.zeebe.monitor.rest.dto.CalledProcessInstanceDto in project zeebe-simple-monitor by camunda-community-hub.

the class InstancesCalledProcessesListViewController method fillViewDetailsIntoDto.

@Override
protected void fillViewDetailsIntoDto(ProcessInstanceEntity instance, List<ElementInstanceEntity> events, List<IncidentEntity> incidents, Map<Long, String> elementIdsForKeys, Map<String, Object> model, Pageable pageable, ProcessInstanceDto dto) {
    final var calledProcessInstances = processInstanceRepository.findByParentProcessInstanceKey(instance.getKey(), pageable).stream().map(childEntity -> {
        final var childDto = new CalledProcessInstanceDto();
        childDto.setChildProcessInstanceKey(childEntity.getKey());
        childDto.setChildBpmnProcessId(childEntity.getBpmnProcessId());
        childDto.setChildState(childEntity.getState());
        childDto.setElementInstanceKey(childEntity.getParentElementInstanceKey());
        final var callElementId = elementIdsForKeys.getOrDefault(childEntity.getParentElementInstanceKey(), "");
        childDto.setElementId(callElementId);
        return childDto;
    }).collect(Collectors.toList());
    dto.setCalledProcessInstances(calledProcessInstances);
    final long count = processInstanceRepository.countByParentProcessInstanceKey(instance.getKey());
    addPaginationToModel(model, pageable, count);
}
Also used : PathVariable(org.springframework.web.bind.annotation.PathVariable) ProcessInstanceEntity(io.zeebe.monitor.entity.ProcessInstanceEntity) Transactional(javax.transaction.Transactional) CalledProcessInstanceDto(io.zeebe.monitor.rest.dto.CalledProcessInstanceDto) ElementInstanceEntity(io.zeebe.monitor.entity.ElementInstanceEntity) Controller(org.springframework.stereotype.Controller) Collectors(java.util.stream.Collectors) List(java.util.List) ProcessInstanceDto(io.zeebe.monitor.rest.dto.ProcessInstanceDto) Map(java.util.Map) GetMapping(org.springframework.web.bind.annotation.GetMapping) Pageable(org.springframework.data.domain.Pageable) PageableDefault(org.springframework.data.web.PageableDefault) IncidentEntity(io.zeebe.monitor.entity.IncidentEntity) CalledProcessInstanceDto(io.zeebe.monitor.rest.dto.CalledProcessInstanceDto)

Aggregations

ElementInstanceEntity (io.zeebe.monitor.entity.ElementInstanceEntity)1 IncidentEntity (io.zeebe.monitor.entity.IncidentEntity)1 ProcessInstanceEntity (io.zeebe.monitor.entity.ProcessInstanceEntity)1 CalledProcessInstanceDto (io.zeebe.monitor.rest.dto.CalledProcessInstanceDto)1 ProcessInstanceDto (io.zeebe.monitor.rest.dto.ProcessInstanceDto)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Transactional (javax.transaction.Transactional)1 Pageable (org.springframework.data.domain.Pageable)1 PageableDefault (org.springframework.data.web.PageableDefault)1 Controller (org.springframework.stereotype.Controller)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 PathVariable (org.springframework.web.bind.annotation.PathVariable)1