class DataSetService extends BaseDataSetService {

    @RequestMapping(value = "/datasets", method = RequestMethod.GET)
    @ApiOperation(value = "List all data sets and filters on certified, or favorite or a limited number when asked",
            notes = "Returns the list of data sets (and filters) the current user is allowed to see. Creation date is a Epoch time value (in UTC time zone).")
    @Timed
    public Stream<DatasetDTO> list(
            @ApiParam(value = "Sort key (by name, creation or modification date)") @RequestParam(
                    defaultValue = "creationDate") Sort sort,
            @ApiParam(value = "Order for sort key (desc or asc or modif)") @RequestParam(
                    defaultValue = "desc") Order order,
            @ApiParam(value = "Filter on name containing the specified name") @RequestParam(
                    required = false) String name,
            @ApiParam(value = "Filter on name containing the specified name strictness") @RequestParam(
                    defaultValue = "false") boolean nameStrict,
            @ApiParam(value = "Filter on certified data sets") @RequestParam(defaultValue = "false") boolean certified,
            @ApiParam(value = "Filter on favorite data sets") @RequestParam(defaultValue = "false") boolean favorite,
            @ApiParam(value = "Only return a limited number of data sets") @RequestParam(
                    defaultValue = "false") boolean limit) {

        String userId = security.getUserId();
        final UserData userData = userDataRepository.get(userId);

        Set<String> favorites = new HashSet<>();
        if (userData != null) {
            favorites = userData.getFavoritesDatasets();
        }

        Stream<DataSetMetadata> datasetList =
                findDataset(sort, order, name, nameStrict, certified, favorite, limit, favorites);

        Set<String> finalFavorites = favorites;
        return datasetList.map(p -> beanConversionService.convert(p, DatasetDTO.class, injectFavorite(finalFavorites)));
    }

}