class DatabaseFDFlowManager extends BaseService implements FDFlowManager {

    @Override
    public List<FDFlowEvent> getFlowEvents(final String flowId) {
        if (StringUtils.isBlank(flowId)) {
            throw new IllegalArgumentException("Flow id cannot be null or blank");
        }

        final Optional<FDFlowEntity> flowEntity = flowRepository.findById(flowId);
        if (!flowEntity.isPresent()) {
            throw new ResourceNotFoundException("No flow exists with the provided flow id");
        }

        final List<FDFlowEvent> events = new ArrayList<>();
        flowEventRepository.findByFlowOrderByFlowRevisionAsc(flowEntity.get()).forEach(e -> {
            final FDFlowEvent flowEvent = modelMapper.map(e, FDFlowEvent.class);
            events.add(flowEvent);
        });
        return events;
    }

    @Autowired public  DatabaseFDFlowManager(final FDFlowRepository flowRepository,
                                 final FDFlowEventRepository flowEventRepository,
                                 final OptionalModelMapper modelMapper,
                                 final ObjectMapper objectMapper,
                                 final Validator validator);

}