app/repository/ArtistRepository.java
public Artist populateArtist(Artist artist) {
     Map<Integer, PassportCountry> countries = new HashMap<>();
     Optional<Map<Integer, PassportCountry>> countryMap = getCountryList(artist.getArtistId());
     if (countryMap.isPresent()) {
       countries = countryMap.get();
     }

     artist.setCountry(countries);
        Optional<List<MusicGenre>> genreList = genreRepository.getArtistGenres(artist.getArtistId());
        if(genreList.isPresent() && !genreList.get().isEmpty()) {
            artist.setGenre(genreList.get());
        }

        artist.setFollowerCount(getNumFollowers(artist.getArtistId()));

        return artist;
    }
/**
     * Method to populate a artist with all linking table data eg genre and country
     * @param artist Artist to be have added linking table data
     * @return Artist that has had genre and country added
     */
Method to populate a artist with all linking table data eg genre and country
@param artist Artist to be have added linking table data
@return Artist that has had genre and country added
Method to populate a artist with all linking table data eg genre and country @param artist Artist to be have added linking table data @return Artist that has had genre and country added
public Artist populateArtist(Artist artist) {
     Map<Integer, PassportCountry> countries = new HashMap<>();
     Optional<Map<Integer, PassportCountry>> countryMap = getCountryList(artist.getArtistId());
     if (countryMap.isPresent()) {
       countries = countryMap.get();
     }
     artist.setCountry(countries);
        Optional<List<MusicGenre>> genreList = genreRepository.getArtistGenres(artist.getArtistId());
        if(genreList.isPresent() && !genreList.get().isEmpty()) {
            artist.setGenre(genreList.get());
        }
        artist.setFollowerCount(getNumFollowers(artist.getArtistId()));
        return artist;
    }
public Artist populateArtist ( Artist artist ) { Map < Integer , PassportCountry > countries = new HashMap < > ( ) ; Optional < Map < Integer , PassportCountry > > countryMap = getCountryList ( artist . getArtistId ( ) ) ; if ( countryMap . isPresent ( ) ) { countries = countryMap . get ( ) ; } artist . setCountry ( countries ) ; Optional < List < MusicGenre > > genreList = genreRepository . getArtistGenres ( artist . getArtistId ( ) ) ; if ( genreList . isPresent ( ) && ! genreList . get ( ) . isEmpty ( ) ) { artist . setGenre ( genreList . get ( ) ) ; } artist . setFollowerCount ( getNumFollowers ( artist . getArtistId ( ) ) ) ; return artist ; }
Method to populate a artist with all linking table data eg genre and country
 @param artist Artist to be have added linking table data
 @return Artist that has had genre and country added
Method to populate a artist with all linking table data eg genre and country @param artist Artist to be have added linking table data @return Artist that has had genre and country added