class CatalogRest {

    @GET
    @Path("{catalogId}/records")
    @Produces(MediaType.APPLICATION_JSON)
    @RolesAllowed("user")
    @ApiOperation("Retrieves the Records in the Catalog.")
    public Response getRecords(@Context UriInfo uriInfo,
                        @PathParam("catalogId") String catalogId,
                        @QueryParam("sort") String sort,
                        @QueryParam("type") String recordType,
                        @QueryParam("offset") int offset,
                        @QueryParam("limit") int limit,
                        @DefaultValue("true") @QueryParam("ascending") boolean asc,
                        @QueryParam("searchText") String searchText) {
        try {
            validatePaginationParams(sort, SORT_RESOURCES, limit, offset);

            PaginatedSearchParams.Builder builder = new PaginatedSearchParams.Builder().offset(offset).ascending(asc);

            if (limit > 0) {
                builder.limit(limit);
            }
            if (sort != null) {
                builder.sortBy(vf.createIRI(sort));
            }
            if (recordType != null) {
                builder.typeFilter(vf.createIRI(recordType));
            }
            if (searchText != null) {
                builder.searchText(searchText);
            }

            PaginatedSearchResults<Record> records = catalogManager.findRecord(vf.createIRI(catalogId),
                    builder.build());

            return createPaginatedResponseJackson(uriInfo, records.getPage(), records.getTotalSize(), limit, offset,
                    Record.TYPE, transformer, bNodeService);
        } catch (IllegalArgumentException ex) {
            throw ErrorUtils.sendError(ex, ex.getMessage(), Response.Status.BAD_REQUEST);
        } catch (MobiException ex) {
            throw ErrorUtils.sendError(ex, ex.getMessage(), Response.Status.INTERNAL_SERVER_ERROR);
        }
    }

}