class FlowLogDBService implements FlowLogService {

    public FlowLog getLastFlowLogByResourceCrnOrName(String resource) {
        Long resourceId = getResourceIdByCrnOrName(resource);
        Iterator<FlowLog> iterator = findAllByResourceIdOrderByCreatedDesc(resourceId).iterator();
        if (iterator.hasNext()) {
            return iterator.next();
        }
        throw new NotFoundException("Flow log for resource not found!");
    }

}