/******************************************************************************************************************* * ******************************************************************************************************************/ @Nonnull protected <ENTITY, FINDER extends SourceAwareFinder<ENTITY, FINDER>> FINDER configured (final @Nonnull FINDER finder) { return finder.importedFrom(source).withFallback(fallback); } }
/******************************************************************************************************************* * * Constrains the search to the entity with the given path. * * @param path the path * @return the {@code Finder} * ******************************************************************************************************************/ @Nonnull public default PathAwareFinder withPath (@Nonnull String path) { return withPath(Paths.get(path)); } }
@Override @Nonnull public TrackFinder findTracks() { return _findTracks().madeBy(this); }
/******************************************************************************************************************* * * Constrains the search to tracks contained in the given record. * * @param record the record * @return the {@code Finder}, in fluent fashion * ******************************************************************************************************************/ @Nonnull public default TrackFinder inRecord (final @Nonnull Record record) { return inRecord(record.getId()); } }
@Override @Nonnull public Optional<Performance> getPerformance() { return performance.get(() -> _findPerformances().ofTrack(this).optionalFirstResult()); }
@Override @Nonnull public Optional<Record> getRecord() { return record.get(() -> _findRecords().containingTrack(this).optionalFirstResult()); }
@Override @Nonnull public RecordFinder findRecords() { return _findRecords().madeBy(this); }
@Override @Nonnull public PerformanceFinder findPerformances() { return _findPerformances().performedBy(this); }
@Override @Nonnull public MusicPerformerFinder findPerformers() { return _findPerformers().performerOf(this); }
/******************************************************************************************************************* * * Constrains the search to records containing the given track. * * @param track the track * @return the {@code Finder}, in fluent fashion * ******************************************************************************************************************/ @Nonnull public default RecordFinder containingTrack (final @Nonnull Track track) { return RecordFinder.this.containingTrack(track.getId()); } }
/******************************************************************************************************************* * * Constrains the search to performances of the given track. * * @param track the track * @return the {@code Finder}, in fluent fashion * ******************************************************************************************************************/ @Nonnull public default PerformanceFinder ofTrack (final @Nonnull Track track) { return ofTrack(track.getId()); }
/******************************************************************************************************************* * * Constrains the search to artists who are makers of the given entity. * * @param entity the entity * @return the {@code Finder}, in fluent fashion * ******************************************************************************************************************/ @Nonnull public default MusicArtistFinder makerOf (final @Nonnull Identifiable entity) { return makerOf(entity.getId()); } }
@Override @Nonnull public Optional<Record> getRecord() { return trackId.flatMap(tid -> new RepositoryRecordFinder(repository).containingTrack(tid).optionalFirstResult()); }
public RepositoryBrowserByTrack() { super(catalog -> catalog.findTracks().sort(new ByTrackName())); } }
@Nonnull private <ENTITY, FINDER extends SourceAwareFinder<ENTITY, FINDER>> FINDER configured (final @Nonnull FINDER finder) { return finder.importedFrom(getSource()).withFallback(getFallback()); } }
@Override @Nonnull public TrackFinder findTracks() { return configured(new RepositoryOptimizedTrackFinder(repository, trackCount)).inRecord(this); }
/******************************************************************************************************************* * * Constrains the search to tracks made by the given artist. * * @param artist the artist * @return the {@code Finder}, in fluent fashion * ******************************************************************************************************************/ @Nonnull public default TrackFinder madeBy (final @Nonnull MusicArtist artist) { return madeBy(artist.getId()); }
/******************************************************************************************************************* * * Constrains the search to records made by the given artist. * * @param artist the artist * @return the {@code Finder}, in fluent fashion * ******************************************************************************************************************/ @Nonnull public default RecordFinder madeBy (final @Nonnull MusicArtist artist) { return madeBy(artist.getId()); }
/******************************************************************************************************************* * * Constrains the search to performances of the given performer. * * @param performer the id of the performer * @return the {@code Finder}, in fluent fashion * ******************************************************************************************************************/ @Nonnull public default PerformanceFinder performedBy (final @Nonnull MusicArtist performer) { return performedBy(performer.getId()); } }
/******************************************************************************************************************* * * Constrains the search to artists who are performers of the given entity. * * @param performance the performance * @return the {@code Finder}, in fluent fashion * ******************************************************************************************************************/ @Nonnull public default MusicPerformerFinder performerOf (final @Nonnull Performance performance) { return performerOf(performance.getId()); } }