app/repository/ArtistRepository.java
public CompletionStage<Integer> editArtistProfile(Integer artistId, Artist newArtist, Form<Artist> artistForm, Integer currentUserId) {
        return supplyAsync(() -> {
            Transaction txn = ebeanServer.beginTransaction();
            Artist targetArtist = ebeanServer.find(Artist.class).setId(artistId).findOne();
            if (targetArtist != null) {
                targetArtist.setArtistName(newArtist.getArtistName());
                targetArtist.setBiography(newArtist.getBiography());
                targetArtist.setMembers(newArtist.getMembers());
                targetArtist.setFacebookLink(newArtist.getFacebookLink());
                targetArtist.setSpotifyLink(newArtist.getSpotifyLink());
                targetArtist.setWebsiteLink(newArtist.getWebsiteLink());
                targetArtist.setInstagramLink(newArtist.getInstagramLink());
                targetArtist.setTwitterLink(newArtist.getTwitterLink());
                targetArtist.update();
                txn.commit();

                newArtist.setArtistId(artistId);
                deleteAllSpecifiedEntriesForAnArtist(artistId, "artist_country");
                deleteAllSpecifiedEntriesForAnArtist(artistId, "artist_genre");
                deleteAllSpecifiedEntriesForAnArtist(artistId, "artist_profile");

                saveAdminArtistCountries(newArtist);
                saveAdminArtistGenres(newArtist, artistForm);
                saveAdminArtistAdmins(newArtist, artistForm, currentUserId);
            }

            return artistId;
        });
    }
/**
     * Updates an Artist object in the database by taking in an id of an already existing artist and changing its attributes
     * Also updates the corresponding artist countries and artist genres database tables
     *
     * @param artistId the id of the artist being edited
     * @param newArtist the artist object that will be edited
     * @return the same artist id of the artist object that got edited
     */
Updates an Artist object in the database by taking in an id of an already existing artist and changing its attributes
Also updates the corresponding artist countries and artist genres database tables

@param artistId the id of the artist being edited
@param newArtist the artist object that will be edited
@return the same artist id of the artist object that got edited
Updates an Artist object in the database by taking in an id of an already existing artist and changing its attributes Also updates the corresponding artist countries and artist genres database tables @param artistId the id of the artist being edited @param newArtist the artist object that will be edited @return the same artist id of the artist object that got edited
public CompletionStage<Integer> editArtistProfile(Integer artistId, Artist newArtist, Form<Artist> artistForm, Integer currentUserId) {
        return supplyAsync(() -> {
            Transaction txn = ebeanServer.beginTransaction();
            Artist targetArtist = ebeanServer.find(Artist.class).setId(artistId).findOne();
            if (targetArtist != null) {
                targetArtist.setArtistName(newArtist.getArtistName());
                targetArtist.setBiography(newArtist.getBiography());
                targetArtist.setMembers(newArtist.getMembers());
                targetArtist.setFacebookLink(newArtist.getFacebookLink());
                targetArtist.setSpotifyLink(newArtist.getSpotifyLink());
                targetArtist.setWebsiteLink(newArtist.getWebsiteLink());
                targetArtist.setInstagramLink(newArtist.getInstagramLink());
                targetArtist.setTwitterLink(newArtist.getTwitterLink());
                targetArtist.update();
                txn.commit();
                newArtist.setArtistId(artistId);
                deleteAllSpecifiedEntriesForAnArtist(artistId, "artist_country");
                deleteAllSpecifiedEntriesForAnArtist(artistId, "artist_genre");
                deleteAllSpecifiedEntriesForAnArtist(artistId, "artist_profile");
                saveAdminArtistCountries(newArtist);
                saveAdminArtistGenres(newArtist, artistForm);
                saveAdminArtistAdmins(newArtist, artistForm, currentUserId);
            }
            return artistId;
        });
    }
public CompletionStage < Integer > editArtistProfile ( Integer artistId , Artist newArtist , Form < Artist > artistForm , Integer currentUserId ) { return supplyAsync ( ( ) -> { Transaction txn = ebeanServer . beginTransaction ( ) ; Artist targetArtist = ebeanServer . find ( Artist . class ) . setId ( artistId ) . findOne ( ) ; if ( targetArtist != null ) { targetArtist . setArtistName ( newArtist . getArtistName ( ) ) ; targetArtist . setBiography ( newArtist . getBiography ( ) ) ; targetArtist . setMembers ( newArtist . getMembers ( ) ) ; targetArtist . setFacebookLink ( newArtist . getFacebookLink ( ) ) ; targetArtist . setSpotifyLink ( newArtist . getSpotifyLink ( ) ) ; targetArtist . setWebsiteLink ( newArtist . getWebsiteLink ( ) ) ; targetArtist . setInstagramLink ( newArtist . getInstagramLink ( ) ) ; targetArtist . setTwitterLink ( newArtist . getTwitterLink ( ) ) ; targetArtist . update ( ) ; txn . commit ( ) ; newArtist . setArtistId ( artistId ) ; deleteAllSpecifiedEntriesForAnArtist ( artistId , "artist_country" ) ; deleteAllSpecifiedEntriesForAnArtist ( artistId , "artist_genre" ) ; deleteAllSpecifiedEntriesForAnArtist ( artistId , "artist_profile" ) ; saveAdminArtistCountries ( newArtist ) ; saveAdminArtistGenres ( newArtist , artistForm ) ; saveAdminArtistAdmins ( newArtist , artistForm , currentUserId ) ; } return artistId ; } ) ; }
Updates an Artist object in the database by taking in an id of an already existing artist and changing its attributes
 Also updates the corresponding artist countries and artist genres database tables
Updates an Artist object in the database by taking in an id of an already existing artist and changing its attributes Also updates the corresponding artist countries and artist genres database tables