Class FestivalServiceImpl

java.lang.Object
org.localify.festival.FestivalServiceImpl
All Implemented Interfaces:
FestivalService

@Service public class FestivalServiceImpl extends Object implements FestivalService
Implementation of the FestivalService interface.
  • Constructor Details

    • FestivalServiceImpl

      @Autowired public FestivalServiceImpl(FestivalRepository festivalRepository, FestivalStageRepository festivalStageRepository, VenueRepository venueRepository, ArtistRepository artistRepository, SpotifyService spotifyService, FestivalArtistRepository festivalArtistRepository, FestivalPerformanceRepository festivalPerformanceRepository, FestivalPerformanceArtistRepository festivalPerformanceArtistRepository, CityRepository cityRepository, CityService cityService, FestivalUserRepository festivalUserRepository, UserFavoriteArtistRepository userFavoriteArtistRepository)
      Constructs a new FestivalServiceImpl.
      Parameters:
      festivalRepository - The festival repository.
      festivalStageRepository - The festival stage repository.
      venueRepository - The venue repository.
      artistRepository - The artist repository.
      spotifyService - The Spotify service.
      festivalArtistRepository - The festival artist repository.
      festivalPerformanceRepository - The festival performance repository.
      festivalPerformanceArtistRepository - The festival performance artist repository.
      cityRepository - The city repository.
      cityService - The city service.
      festivalUserRepository - The festival user repository.
      userFavoriteArtistRepository - The user favorite artist repository.
  • Method Details

    • createOrUpdateFestival

      @Transactional public FestivalCreationResponse createOrUpdateFestival(FestivalRequest festivalRequest)
      Description copied from interface: FestivalService
      Creates or updates a festival.
      Specified by:
      createOrUpdateFestival in interface FestivalService
      Parameters:
      festivalRequest - The festival request object.
      Returns:
      The festival creation response.
    • createOrUpdateFestivalPrimaryInfo

      public Festival createOrUpdateFestivalPrimaryInfo(FestivalRequest festivalRequest)
      Creates or updates the primary information for a festival.
      Parameters:
      festivalRequest - The festival request object.
      Returns:
      The created or updated festival.
    • updateFestivalInformation

      public Festival updateFestivalInformation(Festival festival, List<FestivalPerformanceRequest> performances, Set<String> artistNamesWithNoSpotifyId)
      Updates the information for a festival, including performances and artists.
      Parameters:
      festival - The festival to update.
      performances - The list of performances.
      artistNamesWithNoSpotifyId - A set to store the names of artists with no Spotify ID.
      Returns:
      The updated festival.
    • deleteFestivalAssociatedInformation

      public void deleteFestivalAssociatedInformation(UUID festivalId)
      Deletes all information associated with a festival.
      Parameters:
      festivalId - The ID of the festival.
    • getArtistsFromFestivalArtists

      public List<Artist> getArtistsFromFestivalArtists(List<FestivalArtistRequest> festivalArtists, Set<String> artistNamesWithNoSpotifyId)
      Gets a list of artists from a list of festival artist requests.
      Parameters:
      festivalArtists - The list of festival artist requests.
      artistNamesWithNoSpotifyId - A set to store the names of artists with no Spotify ID.
      Returns:
      A list of artists.
    • saveFestivalArtists

      public void saveFestivalArtists(Festival festival, List<Artist> artists)
      Saves the artists for a festival.
      Parameters:
      festival - The festival.
      artists - The list of artists.
    • findOrCreateStage

      public FestivalStage findOrCreateStage(Festival festival, String stageName, String stageAddress)
      Finds or creates a stage for a festival.
      Parameters:
      festival - The festival.
      stageName - The name of the stage.
      stageAddress - The address of the stage.
      Returns:
      The found or created stage.
    • createPerformance

      public FestivalPerformance createPerformance(FestivalStage stage, FestivalPerformanceRequest performanceRequest, ZoneId timeZone)
      Creates a performance for a festival.
      Parameters:
      stage - The stage of the performance.
      performanceRequest - The performance request object.
      timeZone - The time zone of the festival.
      Returns:
      The created performance.
    • saveFestivalPerformanceArtists

      public void saveFestivalPerformanceArtists(FestivalPerformance performance, List<Artist> artists)
      Saves the artists for a festival performance.
      Parameters:
      performance - The performance.
      artists - The list of artists.
    • getByIdOrThrow

      public Festival getByIdOrThrow(UUID festivalId)
      Gets a festival by its ID, or throws an exception if not found.
      Parameters:
      festivalId - The ID of the festival.
      Returns:
      The festival.
    • getFestivalById

      @Transactional(readOnly=true) public FestivalResponse getFestivalById(UUID userId, UUID festivalId)
      Description copied from interface: FestivalService
      Gets a festival by its ID.
      Specified by:
      getFestivalById in interface FestivalService
      Parameters:
      userId - The ID of the user.
      festivalId - The ID of the festival.
      Returns:
      The festival response.
    • getFestivalPerformancesById

      public List<FestivalPerformanceResponse> getFestivalPerformancesById(UUID festivalId)
      Description copied from interface: FestivalService
      Gets the performances for a festival by its ID.
      Specified by:
      getFestivalPerformancesById in interface FestivalService
      Parameters:
      festivalId - The ID of the festival.
      Returns:
      A list of festival performance responses.
    • getFestivalStagesById

      public List<FestivalStageResponse> getFestivalStagesById(UUID festivalId)
      Description copied from interface: FestivalService
      Gets the stages for a festival by its ID.
      Specified by:
      getFestivalStagesById in interface FestivalService
      Parameters:
      festivalId - The ID of the festival.
      Returns:
      A list of festival stage responses.
    • getFestivalArtistsById

      @Transactional(readOnly=true) public List<FestivalArtistResponse> getFestivalArtistsById(UUID userId, UUID festivalId)
      Description copied from interface: FestivalService
      Gets the artists for a festival by its ID.
      Specified by:
      getFestivalArtistsById in interface FestivalService
      Parameters:
      userId - The ID of the user.
      festivalId - The ID of the festival.
      Returns:
      A list of festival artist responses.
    • getNearbyFestivals

      public List<Festival> getNearbyFestivals(UUID cityId, Double radius)
      Description copied from interface: FestivalService
      Gets a list of nearby festivals.
      Specified by:
      getNearbyFestivals in interface FestivalService
      Parameters:
      cityId - The ID of the city to search near.
      radius - The search radius in meters.
      Returns:
      A list of festivals.
    • getBasicArtistsForFestival

      @Transactional(readOnly=true) public List<BasicArtistResponse> getBasicArtistsForFestival(UUID festivalId)
      Description copied from interface: FestivalService
      Gets a list of basic artist information for a festival.
      Specified by:
      getBasicArtistsForFestival in interface FestivalService
      Parameters:
      festivalId - The ID of the festival.
      Returns:
      A list of basic artist responses.