Package org.localify.artist.jpa
Class Artist
java.lang.Object
org.localify.artist.jpa.Artist
Represents an artist in the Localify system.
This class is a JPA entity that maps to the "artists" table in the database.
It contains information about the artist, including their name, Spotify ID, Apple ID, and other details.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder class for creating instances ofArtist. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasRecommendedSimilarArtist(Double score) Converts the artist to a recommended similar artist DTO.Converts the artist to a similar artist response DTO.voidban()Bans the artist.static Artist.ArtistBuilderbuilder()Returns a new builder for creating anArtist.booleanGets the artist's Apple Music ID.booleanReturns whether the artist was found on Bandsintown.Gets the artist's Bandsintown ID.Gets the timestamp when the artist was last queued for a Bandsintown update.Gets the timestamp when the artist's Bandsintown data was last updated.Gets the timestamp when the artist was banned.Gets the timestamp when the artist was created.getId()Gets the artist's ID.getImage()Gets the artist's image URL.getName()Gets the artist's name.Gets the artist's Pollstar ID.Gets the timestamp when the artist was last queued for a Pollstar update.Gets the timestamp when the artist's Pollstar data was last updated.getSongs()Gets the songs by the artist.Gets the timestamp when the artist's Spotify events were last updated.Gets the number of followers the artist has on Spotify.Gets the artist's Spotify ID.Gets the artist's image URL on Spotify.Gets the artist's popularity on Spotify.Gets the timestamp when the artist was last queued for a Spotify update.Gets the timestamp when fetching the artist's top track from Spotify failed.Gets a URL to a preview of the artist's top track on Spotify.Gets the timestamp when the artist's Spotify data was last updated.Gets the timestamp when the artist was last updated.voidsetAppleId(String appleId) Sets the artist's Apple Music ID.voidsetBandsInTownFound(boolean bandsInTownFound) Sets whether the artist was found on Bandsintown.voidsetBandsInTownId(String bandsInTownId) Sets the artist's Bandsintown ID.voidSets the Bandsintown queued timestamp to the current time.voidSets the Bandsintown updated timestamp to the current time.voidsetBandsInTownQueuedAt(Instant bandsInTownQueuedAt) Sets the timestamp when the artist was last queued for a Bandsintown update.voidsetBandsInTownUpdatedAt(Instant bandsInTownUpdatedAt) Sets the timestamp when the artist's Bandsintown data was last updated.voidSets the artist's name.voidsetPollstarId(String pollstarId) Sets the artist's Pollstar ID.voidSets the Pollstar queued timestamp to the current time.voidSets the Pollstar queued timestamp to the current time.voidSets the Pollstar updated timestamp to the current time.voidsetPollstarQueuedAt(Instant pollstarQueuedAt) Sets the timestamp when the artist was last queued for a Pollstar update.voidsetPollstarUpdatedAt(Instant pollstarUpdatedAt) Sets the timestamp when the artist's Pollstar data was last updated.voidSets the songs by the artist.voidSets the Spotify events updated timestamp to the current time.voidsetSpotifyEventsUpdatedAt(Instant spotifyEventsUpdatedAt) Sets the timestamp when the artist's Spotify events were last updated.voidsetSpotifyFollowers(Integer spotifyFollowers) Sets the number of followers the artist has on Spotify.voidsetSpotifyId(String spotifyId) Sets the artist's Spotify ID.voidsetSpotifyImage(String spotifyImage) Sets the artist's image URL on Spotify.voidSets the Spotify queued timestamp to the current time.voidSets the Spotify updated timestamp to the current time.voidsetSpotifyPopularity(Integer spotifyPopularity) Sets the artist's popularity on Spotify.voidsetSpotifyQueuedAt(Instant spotifyQueuedAt) Sets the timestamp when the artist was last queued for a Spotify update.voidsetSpotifyTopTrackFailedAt(Instant spotifyTopTrackFailedAt) Sets the timestamp when fetching the artist's top track from Spotify failed.voidsetSpotifyTopTrackPreview(String spotifyTopTrackPreview) Sets a URL to a preview of the artist's top track on Spotify.voidsetSpotifyUpdatedAt(Instant spotifyUpdatedAt) Sets the timestamp when the artist's Spotify data was last updated.voidSets the updated_at timestamp to the current time.Converts the artist to an artist popularity response DTO.toEventArtistResponse(City closestCity) Converts the artist to an event artist response DTO.toExtendedResponse(List<GenreResponse> genres, List<ExtendedArtistResponse.SimilarArtistResponse> similarArtists, Boolean isFavorite, List<ArtistCityResponse> cities, Boolean isSeed) Converts the artist to an extended response DTO.toLocalResponse(Boolean isLocal) Converts the artist to a local response DTO.Converts the artist to a basic response DTO.voidunban()Unbans the artist.
-
Constructor Details
-
Artist
protected Artist()Protected no-args constructor for JPA. -
Artist
Constructs a new artist with the given name.- Parameters:
name- the name of the artist
-
-
Method Details
-
getSpotifyFollowers
Gets the number of followers the artist has on Spotify.- Returns:
- the number of followers
-
setSpotifyFollowers
Sets the number of followers the artist has on Spotify.- Parameters:
spotifyFollowers- the number of followers
-
toResponse
Converts the artist to a basic response DTO.- Returns:
- the basic artist response DTO
-
toEventArtistResponse
Converts the artist to an event artist response DTO.- Parameters:
closestCity- the closest city to the artist- Returns:
- the event artist response DTO
-
toLocalResponse
Converts the artist to a local response DTO.- Parameters:
isLocal- whether the artist is local- Returns:
- the basic artist local response DTO
-
toExtendedResponse
public ExtendedArtistResponse toExtendedResponse(List<GenreResponse> genres, List<ExtendedArtistResponse.SimilarArtistResponse> similarArtists, Boolean isFavorite, List<ArtistCityResponse> cities, Boolean isSeed) Converts the artist to an extended response DTO.- Parameters:
genres- the artist's genressimilarArtists- the artist's similar artistsisFavorite- whether the artist is a favorite of the usercities- the cities associated with the artistisSeed- whether the artist is a seed artist for the user- Returns:
- the extended artist response DTO
-
asSimilarArtist
Converts the artist to a similar artist response DTO.- Returns:
- the similar artist response DTO
-
asRecommendedSimilarArtist
Converts the artist to a recommended similar artist DTO.- Parameters:
score- the similarity score- Returns:
- the recommended similar artist DTO
-
toArtistPopularity
Converts the artist to an artist popularity response DTO.- Returns:
- the artist popularity response DTO
-
getSpotifyTopTrackFailedAt
Gets the timestamp when fetching the artist's top track from Spotify failed.- Returns:
- the timestamp
-
setSpotifyTopTrackFailedAt
Sets the timestamp when fetching the artist's top track from Spotify failed.- Parameters:
spotifyTopTrackFailedAt- the timestamp
-
getImage
Gets the artist's image URL.- Returns:
- the image URL
-
getId
Gets the artist's ID.- Returns:
- the ID
-
getCreatedAt
Gets the timestamp when the artist was created.- Returns:
- the creation timestamp
-
getUpdatedAt
Gets the timestamp when the artist was last updated.- Returns:
- the last updated timestamp
-
getBannedAt
Gets the timestamp when the artist was banned.- Returns:
- the banned timestamp
-
getName
Gets the artist's name.- Returns:
- the name
-
ban
public void ban()Bans the artist. -
unban
public void unban()Unbans the artist. -
getSpotifyId
Gets the artist's Spotify ID.- Returns:
- the Spotify ID
-
getAppleId
Gets the artist's Apple Music ID.- Returns:
- the Apple Music ID
-
setName
Sets the artist's name.- Parameters:
name- the name
-
setSpotifyId
Sets the artist's Spotify ID.- Parameters:
spotifyId- the Spotify ID
-
setAppleId
Sets the artist's Apple Music ID.- Parameters:
appleId- the Apple Music ID
-
getSpotifyPopularity
Gets the artist's popularity on Spotify.- Returns:
- the popularity
-
getSpotifyImage
Gets the artist's image URL on Spotify.- Returns:
- the image URL
-
setSpotifyPopularity
Sets the artist's popularity on Spotify.- Parameters:
spotifyPopularity- the popularity
-
setSpotifyImage
Sets the artist's image URL on Spotify.- Parameters:
spotifyImage- the image URL
-
setUpdatedAt
public void setUpdatedAt()Sets the updated_at timestamp to the current time. -
getBandsInTownId
Gets the artist's Bandsintown ID.- Returns:
- the Bandsintown ID
-
getBandsInTownFound
public boolean getBandsInTownFound()Returns whether the artist was found on Bandsintown.- Returns:
- true if the artist was found, false otherwise
-
setBandsInTownFound
public void setBandsInTownFound(boolean bandsInTownFound) Sets whether the artist was found on Bandsintown.- Parameters:
bandsInTownFound- true if the artist was found, false otherwise
-
getBandsInTownQueuedAt
Gets the timestamp when the artist was last queued for a Bandsintown update.- Returns:
- the timestamp
-
getBandsInTownUpdatedAt
Gets the timestamp when the artist's Bandsintown data was last updated.- Returns:
- the timestamp
-
setBandsInTownId
Sets the artist's Bandsintown ID.- Parameters:
bandsInTownId- the Bandsintown ID
-
setBandsInTownQueuedAt
Sets the timestamp when the artist was last queued for a Bandsintown update.- Parameters:
bandsInTownQueuedAt- the timestamp
-
setBandsInTownLastQueued
public void setBandsInTownLastQueued()Sets the Bandsintown queued timestamp to the current time. -
setBandsInTownUpdatedAt
Sets the timestamp when the artist's Bandsintown data was last updated.- Parameters:
bandsInTownUpdatedAt- the timestamp
-
getSpotifyQueuedAt
Gets the timestamp when the artist was last queued for a Spotify update.- Returns:
- the timestamp
-
getSpotifyEventsUpdatedAt
Gets the timestamp when the artist's Spotify events were last updated.- Returns:
- the timestamp
-
setSpotifyEventsLastUpdated
public void setSpotifyEventsLastUpdated()Sets the Spotify events updated timestamp to the current time. -
setSpotifyQueuedAt
Sets the timestamp when the artist was last queued for a Spotify update.- Parameters:
spotifyQueuedAt- the timestamp
-
setSpotifyLastQueued
public void setSpotifyLastQueued()Sets the Spotify queued timestamp to the current time. -
setSpotifyEventsUpdatedAt
Sets the timestamp when the artist's Spotify events were last updated.- Parameters:
spotifyEventsUpdatedAt- the timestamp
-
getPollstarId
Gets the artist's Pollstar ID.- Returns:
- the Pollstar ID
-
getPollstarQueuedAt
Gets the timestamp when the artist was last queued for a Pollstar update.- Returns:
- the timestamp
-
getPollstarUpdatedAt
Gets the timestamp when the artist's Pollstar data was last updated.- Returns:
- the timestamp
-
setPollstarId
Sets the artist's Pollstar ID.- Parameters:
pollstarId- the Pollstar ID
-
setPollstarQueuedAt
Sets the timestamp when the artist was last queued for a Pollstar update.- Parameters:
pollstarQueuedAt- the timestamp
-
setPollstarLastQueued
public void setPollstarLastQueued()Sets the Pollstar queued timestamp to the current time. -
setPollstarLastQueuedAt
public void setPollstarLastQueuedAt()Sets the Pollstar queued timestamp to the current time. -
setPollstarUpdatedAt
Sets the timestamp when the artist's Pollstar data was last updated.- Parameters:
pollstarUpdatedAt- the timestamp
-
getSongs
Gets the songs by the artist.- Returns:
- the list of songs
-
setSongs
Sets the songs by the artist.- Parameters:
songs- the list of songs
-
getSpotifyTopTrackPreview
Gets a URL to a preview of the artist's top track on Spotify.- Returns:
- the URL
-
setSpotifyTopTrackPreview
Sets a URL to a preview of the artist's top track on Spotify.- Parameters:
spotifyTopTrackPreview- the URL
-
getSpotifyUpdatedAt
Gets the timestamp when the artist's Spotify data was last updated.- Returns:
- the timestamp
-
setSpotifyLastUpdated
public void setSpotifyLastUpdated()Sets the Spotify updated timestamp to the current time. -
setSpotifyUpdatedAt
Sets the timestamp when the artist's Spotify data was last updated.- Parameters:
spotifyUpdatedAt- the timestamp
-
setBandsInTownLastUpdated
public void setBandsInTownLastUpdated()Sets the Bandsintown updated timestamp to the current time. -
builder
Returns a new builder for creating anArtist.- Returns:
- the builder
-
equals
-
setPollstarLastUpdated
public void setPollstarLastUpdated()Sets the Pollstar updated timestamp to the current time.
-