public RepositoryBrowserByRecordThenTrack() { super(catalog -> catalog.findRecords()); } }
/******************************************************************************************************************* * * Exports record resources. * * @param source the data source * @param fallback the fallback data source * @return the JSON representation of the records * ******************************************************************************************************************/ @ResponseBody @RequestMapping(value = "/record", produces = { APPLICATION_JSON_VALUE, APPLICATION_XML_VALUE }) public List<RecordResource> getRecords (final @RequestParam(required = false, defaultValue = "embedded") String source, final @RequestParam(required = false, defaultValue = "embedded") String fallback) { log.info("getRecords({}, {})", source, fallback); checkStatus(); return finalized(catalog.findRecords(), source, fallback, RecordResource::new); }
/******************************************************************************************************************* * * Exports a single record resource. * * @param id the record id * @param source the data source * @param fallback the fallback data source * @return the JSON representation of the record * ******************************************************************************************************************/ @ResponseBody @RequestMapping(value = "/record/{id}", produces = { APPLICATION_JSON_VALUE, APPLICATION_XML_VALUE }) public DetailedRecordResource getRecord (final @PathVariable String id, final @RequestParam(required = false, defaultValue = "embedded") String source, final @RequestParam(required = false, defaultValue = "embedded") String fallback) { log.info("getRecord({}, {}, {})", id, source, fallback); checkStatus(); final List<TrackResource> tracks = finalized(catalog.findTracks().inRecord(new Id(id)), source, fallback, TrackResource::new); return single(finalized(catalog.findRecords().withId(new Id(id)), source, fallback, record -> new DetailedRecordResource(record, tracks))); }