Class Artist

java.lang.Object
org.localify.artist.jpa.Artist

@Entity public class Artist extends Object
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.
  • Constructor Details

    • Artist

      protected Artist()
      Protected no-args constructor for JPA.
    • Artist

      public Artist(String name)
      Constructs a new artist with the given name.
      Parameters:
      name - the name of the artist
  • Method Details

    • getSpotifyFollowers

      public Integer getSpotifyFollowers()
      Gets the number of followers the artist has on Spotify.
      Returns:
      the number of followers
    • setSpotifyFollowers

      public void setSpotifyFollowers(Integer spotifyFollowers)
      Sets the number of followers the artist has on Spotify.
      Parameters:
      spotifyFollowers - the number of followers
    • toResponse

      public BasicArtistResponse toResponse()
      Converts the artist to a basic response DTO.
      Returns:
      the basic artist response DTO
    • toEventArtistResponse

      public EventArtistResponse toEventArtistResponse(City closestCity)
      Converts the artist to an event artist response DTO.
      Parameters:
      closestCity - the closest city to the artist
      Returns:
      the event artist response DTO
    • toLocalResponse

      public BasicArtistLocalResponse toLocalResponse(Boolean isLocal)
      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 genres
      similarArtists - the artist's similar artists
      isFavorite - whether the artist is a favorite of the user
      cities - the cities associated with the artist
      isSeed - 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

      public RecommendedArtistDto.SimilarArtistDto asRecommendedSimilarArtist(Double score)
      Converts the artist to a recommended similar artist DTO.
      Parameters:
      score - the similarity score
      Returns:
      the recommended similar artist DTO
    • toArtistPopularity

      public ArtistPopularityResponse toArtistPopularity()
      Converts the artist to an artist popularity response DTO.
      Returns:
      the artist popularity response DTO
    • getSpotifyTopTrackFailedAt

      public Instant getSpotifyTopTrackFailedAt()
      Gets the timestamp when fetching the artist's top track from Spotify failed.
      Returns:
      the timestamp
    • setSpotifyTopTrackFailedAt

      public void setSpotifyTopTrackFailedAt(Instant spotifyTopTrackFailedAt)
      Sets the timestamp when fetching the artist's top track from Spotify failed.
      Parameters:
      spotifyTopTrackFailedAt - the timestamp
    • getImage

      public String getImage()
      Gets the artist's image URL.
      Returns:
      the image URL
    • getId

      public UUID getId()
      Gets the artist's ID.
      Returns:
      the ID
    • getCreatedAt

      public Instant getCreatedAt()
      Gets the timestamp when the artist was created.
      Returns:
      the creation timestamp
    • getUpdatedAt

      public Instant getUpdatedAt()
      Gets the timestamp when the artist was last updated.
      Returns:
      the last updated timestamp
    • getBannedAt

      public Instant getBannedAt()
      Gets the timestamp when the artist was banned.
      Returns:
      the banned timestamp
    • getName

      public String getName()
      Gets the artist's name.
      Returns:
      the name
    • ban

      public void ban()
      Bans the artist.
    • unban

      public void unban()
      Unbans the artist.
    • getSpotifyId

      public String getSpotifyId()
      Gets the artist's Spotify ID.
      Returns:
      the Spotify ID
    • getAppleId

      public String getAppleId()
      Gets the artist's Apple Music ID.
      Returns:
      the Apple Music ID
    • setName

      public void setName(String name)
      Sets the artist's name.
      Parameters:
      name - the name
    • setSpotifyId

      public void setSpotifyId(String spotifyId)
      Sets the artist's Spotify ID.
      Parameters:
      spotifyId - the Spotify ID
    • setAppleId

      public void setAppleId(String appleId)
      Sets the artist's Apple Music ID.
      Parameters:
      appleId - the Apple Music ID
    • getSpotifyPopularity

      public Integer getSpotifyPopularity()
      Gets the artist's popularity on Spotify.
      Returns:
      the popularity
    • getSpotifyImage

      public String getSpotifyImage()
      Gets the artist's image URL on Spotify.
      Returns:
      the image URL
    • setSpotifyPopularity

      public void setSpotifyPopularity(Integer spotifyPopularity)
      Sets the artist's popularity on Spotify.
      Parameters:
      spotifyPopularity - the popularity
    • setSpotifyImage

      public void setSpotifyImage(String spotifyImage)
      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

      public String 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

      public Instant getBandsInTownQueuedAt()
      Gets the timestamp when the artist was last queued for a Bandsintown update.
      Returns:
      the timestamp
    • getBandsInTownUpdatedAt

      public Instant getBandsInTownUpdatedAt()
      Gets the timestamp when the artist's Bandsintown data was last updated.
      Returns:
      the timestamp
    • setBandsInTownId

      public void setBandsInTownId(String bandsInTownId)
      Sets the artist's Bandsintown ID.
      Parameters:
      bandsInTownId - the Bandsintown ID
    • setBandsInTownQueuedAt

      public void setBandsInTownQueuedAt(Instant bandsInTownQueuedAt)
      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

      public void setBandsInTownUpdatedAt(Instant bandsInTownUpdatedAt)
      Sets the timestamp when the artist's Bandsintown data was last updated.
      Parameters:
      bandsInTownUpdatedAt - the timestamp
    • getSpotifyQueuedAt

      public Instant getSpotifyQueuedAt()
      Gets the timestamp when the artist was last queued for a Spotify update.
      Returns:
      the timestamp
    • getSpotifyEventsUpdatedAt

      public Instant 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

      public void setSpotifyQueuedAt(Instant spotifyQueuedAt)
      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

      public void setSpotifyEventsUpdatedAt(Instant spotifyEventsUpdatedAt)
      Sets the timestamp when the artist's Spotify events were last updated.
      Parameters:
      spotifyEventsUpdatedAt - the timestamp
    • getPollstarId

      public String getPollstarId()
      Gets the artist's Pollstar ID.
      Returns:
      the Pollstar ID
    • getPollstarQueuedAt

      public Instant getPollstarQueuedAt()
      Gets the timestamp when the artist was last queued for a Pollstar update.
      Returns:
      the timestamp
    • getPollstarUpdatedAt

      public Instant getPollstarUpdatedAt()
      Gets the timestamp when the artist's Pollstar data was last updated.
      Returns:
      the timestamp
    • setPollstarId

      public void setPollstarId(String pollstarId)
      Sets the artist's Pollstar ID.
      Parameters:
      pollstarId - the Pollstar ID
    • setPollstarQueuedAt

      public void setPollstarQueuedAt(Instant pollstarQueuedAt)
      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

      public void setPollstarUpdatedAt(Instant pollstarUpdatedAt)
      Sets the timestamp when the artist's Pollstar data was last updated.
      Parameters:
      pollstarUpdatedAt - the timestamp
    • getSongs

      public List<Song> getSongs()
      Gets the songs by the artist.
      Returns:
      the list of songs
    • setSongs

      public void setSongs(List<Song> songs)
      Sets the songs by the artist.
      Parameters:
      songs - the list of songs
    • getSpotifyTopTrackPreview

      public String getSpotifyTopTrackPreview()
      Gets a URL to a preview of the artist's top track on Spotify.
      Returns:
      the URL
    • setSpotifyTopTrackPreview

      public void setSpotifyTopTrackPreview(String spotifyTopTrackPreview)
      Sets a URL to a preview of the artist's top track on Spotify.
      Parameters:
      spotifyTopTrackPreview - the URL
    • getSpotifyUpdatedAt

      public Instant 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

      public void setSpotifyUpdatedAt(Instant spotifyUpdatedAt)
      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

      public static Artist.ArtistBuilder builder()
      Returns a new builder for creating an Artist.
      Returns:
      the builder
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • setPollstarLastUpdated

      public void setPollstarLastUpdated()
      Sets the Pollstar updated timestamp to the current time.