Package org.localify.festival
Class FestivalServiceImpl
java.lang.Object
org.localify.festival.FestivalServiceImpl
- All Implemented Interfaces:
FestivalService
Implementation of the FestivalService interface.
-
Constructor Summary
ConstructorsConstructorDescriptionFestivalServiceImpl(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. -
Method Summary
Modifier and TypeMethodDescriptioncreateOrUpdateFestival(FestivalRequest festivalRequest) Creates or updates a festival.createOrUpdateFestivalPrimaryInfo(FestivalRequest festivalRequest) Creates or updates the primary information for a festival.createPerformance(FestivalStage stage, FestivalPerformanceRequest performanceRequest, ZoneId timeZone) Creates a performance for a festival.voiddeleteFestivalAssociatedInformation(UUID festivalId) Deletes all information associated with a festival.findOrCreateStage(Festival festival, String stageName, String stageAddress) Finds or creates a stage for a festival.getArtistsFromFestivalArtists(List<FestivalArtistRequest> festivalArtists, Set<String> artistNamesWithNoSpotifyId) Gets a list of artists from a list of festival artist requests.getBasicArtistsForFestival(UUID festivalId) Gets a list of basic artist information for a festival.getByIdOrThrow(UUID festivalId) Gets a festival by its ID, or throws an exception if not found.getFestivalArtistsById(UUID userId, UUID festivalId) Gets the artists for a festival by its ID.getFestivalById(UUID userId, UUID festivalId) Gets a festival by its ID.getFestivalPerformancesById(UUID festivalId) Gets the performances for a festival by its ID.getFestivalStagesById(UUID festivalId) Gets the stages for a festival by its ID.getNearbyFestivals(UUID cityId, Double radius) Gets a list of nearby festivals.voidsaveFestivalArtists(Festival festival, List<Artist> artists) Saves the artists for a festival.voidsaveFestivalPerformanceArtists(FestivalPerformance performance, List<Artist> artists) Saves the artists for a festival performance.updateFestivalInformation(Festival festival, List<FestivalPerformanceRequest> performances, Set<String> artistNamesWithNoSpotifyId) Updates the information for a festival, including performances and artists.
-
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:FestivalServiceCreates or updates a festival.- Specified by:
createOrUpdateFestivalin interfaceFestivalService- Parameters:
festivalRequest- The festival request object.- Returns:
- The festival creation response.
-
createOrUpdateFestivalPrimaryInfo
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
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
Saves the artists for a festival.- Parameters:
festival- The festival.artists- The list of artists.
-
findOrCreateStage
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
Saves the artists for a festival performance.- Parameters:
performance- The performance.artists- The list of artists.
-
getByIdOrThrow
Gets a festival by its ID, or throws an exception if not found.- Parameters:
festivalId- The ID of the festival.- Returns:
- The festival.
-
getFestivalById
Description copied from interface:FestivalServiceGets a festival by its ID.- Specified by:
getFestivalByIdin interfaceFestivalService- Parameters:
userId- The ID of the user.festivalId- The ID of the festival.- Returns:
- The festival response.
-
getFestivalPerformancesById
Description copied from interface:FestivalServiceGets the performances for a festival by its ID.- Specified by:
getFestivalPerformancesByIdin interfaceFestivalService- Parameters:
festivalId- The ID of the festival.- Returns:
- A list of festival performance responses.
-
getFestivalStagesById
Description copied from interface:FestivalServiceGets the stages for a festival by its ID.- Specified by:
getFestivalStagesByIdin interfaceFestivalService- 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:FestivalServiceGets the artists for a festival by its ID.- Specified by:
getFestivalArtistsByIdin interfaceFestivalService- Parameters:
userId- The ID of the user.festivalId- The ID of the festival.- Returns:
- A list of festival artist responses.
-
getNearbyFestivals
Description copied from interface:FestivalServiceGets a list of nearby festivals.- Specified by:
getNearbyFestivalsin interfaceFestivalService- 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:FestivalServiceGets a list of basic artist information for a festival.- Specified by:
getBasicArtistsForFestivalin interfaceFestivalService- Parameters:
festivalId- The ID of the festival.- Returns:
- A list of basic artist responses.
-