Class City

java.lang.Object
org.localify.city.City

@Entity public class City extends Object
Represents a city.
  • Constructor Details

    • City

      protected City()
      Default constructor for JPA.
    • City

      public City(String name, String zoneCode, String countryCode, org.locationtech.jts.geom.Point geoPoint)
      Constructs a new City.
      Parameters:
      name - The name of the city.
      zoneCode - The zone code of the city.
      countryCode - The country code of the city.
      geoPoint - The geographical point of the city.
  • Method Details

    • getZoneName

      public String getZoneName()
      Gets the zone name of the city.
      Returns:
      The zone name.
    • setZoneName

      public void setZoneName(String zoneName)
      Sets the zone name of the city.
      Parameters:
      zoneName - The zone name.
    • getCountryName

      public String getCountryName()
      Gets the country name of the city.
      Returns:
      The country name.
    • setCountryName

      public void setCountryName(String countryName)
      Sets the country name of the city.
      Parameters:
      countryName - The country name.
    • getNorthRegion

      public Double getNorthRegion()
      Gets the northern boundary of the city's region.
      Returns:
      The northern boundary.
    • setNorthRegion

      public void setNorthRegion(Double northRegion)
      Sets the northern boundary of the city's region.
      Parameters:
      northRegion - The northern boundary.
    • getSouthRegion

      public Double getSouthRegion()
      Gets the southern boundary of the city's region.
      Returns:
      The southern boundary.
    • setSouthRegion

      public void setSouthRegion(Double southRegion)
      Sets the southern boundary of the city's region.
      Parameters:
      southRegion - The southern boundary.
    • getEastRegion

      public Double getEastRegion()
      Gets the eastern boundary of the city's region.
      Returns:
      The eastern boundary.
    • setEastRegion

      public void setEastRegion(Double eastRegion)
      Sets the eastern boundary of the city's region.
      Parameters:
      eastRegion - The eastern boundary.
    • getWestRegion

      public Double getWestRegion()
      Gets the western boundary of the city's region.
      Returns:
      The western boundary.
    • setWestRegion

      public void setWestRegion(Double westRegion)
      Sets the western boundary of the city's region.
      Parameters:
      westRegion - The western boundary.
    • getGoogleQueuedAt

      public Instant getGoogleQueuedAt()
      Gets the timestamp when the city was last queued for a Google update.
      Returns:
      The timestamp.
    • getImage

      public String getImage()
      Gets the URL of an image of the city.
      Returns:
      The image URL.
    • setImage

      public void setImage(String image)
      Sets the URL of an image of the city.
      Parameters:
      image - The image URL.
    • getTimezone

      public String getTimezone()
      Gets the timezone of the city.
      Returns:
      The timezone.
    • setTimezone

      public void setTimezone(String timezone)
      Sets the timezone of the city.
      Parameters:
      timezone - The timezone.
    • getFriendlyName

      public String getFriendlyName()
      Gets a friendly name for the city (e.g., "Ithaca, NY").
      Returns:
      The friendly name.
    • toResponse

      public CityResponse toResponse()
      Converts this city to a CityResponse excluding the description.
      Returns:
      city response
    • toExtendedResponse

      public CityResponseExtended toExtendedResponse(boolean isFavorite, Integer numberOfArtists, Integer numberTotalVenues, Integer numberUpcomingEvents)
      Converts this city to an extended response object.
      Parameters:
      isFavorite - Whether the city is a favorite of the user.
      numberOfArtists - The number of artists in the city.
      numberTotalVenues - The total number of venues in the city.
      numberUpcomingEvents - The number of upcoming events in the city.
      Returns:
      The extended city response.
    • toArtistsResponse

      public CityArtistsResponse toArtistsResponse(boolean isUserLocalCity, org.springframework.data.domain.Page<City.CityArtistApiResponse> topArtists, Integer numberOfArtists, Integer numberTotalVenues, Integer numberUpcomingEvents)
      Converts this city to an artists response object.
      Parameters:
      isUserLocalCity - Whether this is the user's local city.
      topArtists - A page of top artists in the city.
      numberOfArtists - The number of artists in the city.
      numberTotalVenues - The total number of venues in the city.
      numberUpcomingEvents - The number of upcoming events in the city.
      Returns:
      The city artists response.
    • getId

      public UUID getId()
      Gets the ID of the city.
      Returns:
      The ID.
    • getName

      public String getName()
      Gets the name of the city.
      Returns:
      The name.
    • getZoneCode

      public String getZoneCode()
      Gets the zone code of the city.
      Returns:
      The zone code.
    • getCountryCode

      public String getCountryCode()
      Gets the country code of the city.
      Returns:
      The country code.
    • getPopulation

      public Long getPopulation()
      Gets the population of the city.
      Returns:
      The population.
    • getCreatedAt

      public Instant getCreatedAt()
      Gets the creation timestamp of the city.
      Returns:
      The creation timestamp.
    • getUpdatedAt

      public Instant getUpdatedAt()
      Gets the update timestamp of the city.
      Returns:
      The update timestamp.
    • getBannedAt

      public Instant getBannedAt()
      Gets the banned timestamp of the city.
      Returns:
      The banned timestamp.
    • getPlaylist

      public Playlist getPlaylist()
      Gets the playlist associated with the city.
      Returns:
      The playlist.
    • setName

      public void setName(String name)
      Sets the name of the city.
      Parameters:
      name - The name.
    • setZoneCode

      public void setZoneCode(String zoneCode)
      Sets the zone code of the city.
      Parameters:
      zoneCode - The zone code.
    • setCountryCode

      public void setCountryCode(String countryCode)
      Sets the country code of the city.
      Parameters:
      countryCode - The country code.
    • getGeoPoint

      public org.locationtech.jts.geom.Point getGeoPoint()
      Gets the geographical point of the city.
      Returns:
      The geographical point.
    • setGeoPoint

      public void setGeoPoint(org.locationtech.jts.geom.Point geoPoint)
      Sets the geographical point of the city.
      Parameters:
      geoPoint - The geographical point.
    • setPopulation

      public void setPopulation(Long population)
      Sets the population of the city.
      Parameters:
      population - The population.
    • setPlaylist

      public void setPlaylist(Playlist playlist)
      Sets the playlist associated with the city.
      Parameters:
      playlist - The playlist.
    • setCreatedAt

      protected void setCreatedAt(Instant createdAt)
      Sets the creation timestamp of the city.
      Parameters:
      createdAt - The creation timestamp.
    • setBannedAt

      public void setBannedAt(Instant bannedAt)
      Sets the banned timestamp of the city.
      Parameters:
      bannedAt - The banned timestamp.
    • setUpdatedAt

      protected void setUpdatedAt(Instant updatedAt)
      Sets the update timestamp of the city.
      Parameters:
      updatedAt - The update timestamp.
    • getGoogleUpdatedAt

      public Instant getGoogleUpdatedAt()
      Gets the timestamp when the city's Google data was last updated.
      Returns:
      The timestamp.
    • setGoogleUpdatedAt

      public void setGoogleUpdatedAt(Instant googleUpdatedAt)
      Sets the timestamp when the city's Google data was last updated.
      Parameters:
      googleUpdatedAt - The timestamp.
    • setGoogleQueuedAt

      public void setGoogleQueuedAt(Instant googleQueuedAt)
      Sets the timestamp when the city was last queued for a Google update.
      Parameters:
      googleQueuedAt - The timestamp.
    • setGoogleLastQueued

      public void setGoogleLastQueued()
      Sets the Google queued timestamp to the current time.
    • getUniversity

      public Boolean getUniversity()
      Gets whether the city is a university town.
      Returns:
      True if the city is a university town, false otherwise.
    • setUniversity

      public void setUniversity(Boolean university)
      Sets whether the city is a university town.
      Parameters:
      university - True if the city is a university town, false otherwise.
    • getLatitude

      public Double getLatitude()
      Gets the latitude of the city.
      Returns:
      The latitude.
    • getLongitude

      public Double getLongitude()
      Gets the longitude of the city.
      Returns:
      The longitude.
    • toCityArtistProportionResponse

      public CityArtistProportionResponse toCityArtistProportionResponse(Integer numArtists)
      Converts this city to a city-artist proportion response object.
      Parameters:
      numArtists - The number of artists in the city.
      Returns:
      The city-artist proportion response.
    • setPollstarQueuedAt

      public void setPollstarQueuedAt(Instant pollstarQueuedAt)
      Sets the timestamp when the city was last queued for a Pollstar update.
      Parameters:
      pollstarQueuedAt - The timestamp.
    • setPollstarLastQueuedAt

      public void setPollstarLastQueuedAt()
      Sets the Pollstar queued timestamp to the current time.
    • getPollstarId

      public String getPollstarId()
      Gets the Pollstar ID of the city.
      Returns:
      The Pollstar ID.
    • setPollstarId

      public void setPollstarId(String pollstarId)
      Sets the Pollstar ID of the city.
      Parameters:
      pollstarId - The Pollstar ID.
    • getPollstarQueuedAt

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

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

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