Package org.localify.user
Class UserServiceImpl
java.lang.Object
org.localify.user.UserServiceImpl
- All Implemented Interfaces:
UserService
@Service
@Transactional(readOnly=true)
public class UserServiceImpl
extends Object
implements UserService
Implementation of the UserService interface.
-
Constructor Summary
ConstructorsConstructorDescriptionUserServiceImpl(UserRepository userRepository, UserCityRepository userCityRepository, CityRepository cityRepository, UserSeedRepository userSeedRepository, ArtistRepository artistRepository, ServletUtils servletUtils, UserFavoriteArtistRepository userFavoriteArtistRepository, UserSearchRepository userSearchRepository, EventRepository eventRepository, UserFavoriteEventRepository userFavoriteEventRepository, VenueRepository venueRepository, UserFavoriteVenueRepository userFavoriteVenueRepository, AccountLinkTokenRepository accountLinkTokenRepository, RecommendService recommender, PlaylistService playlistService, jakarta.persistence.EntityManager entityManager, UserRecentArtistViewRepository userRecentArtistViewRepository, UserRecentEventViewRepository userRecentEventViewRepository, UserRecentVenueViewRepository userRecentVenueViewRepository, ArtistCityRepository artistCityRepository, UserFeedbackRepository userFeedbackRepository, GoogleDispatch googleDispatch, LocalifyProperties properties, WeeklyEmailRegistrationTokenRepository weeklyEmailRegistrationTokenRepository, FestivalUserRepository festivalUserRepository, FestivalRepository festivalRepository) Constructs a new UserServiceImpl with the given repositories and services. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a seed artist for a user.voidblacklistSeed(UUID userId, UUID seedId) Blacklists a seed artist for a user.voidcanRecommend(UUID userId) Creates an anonymous user.voiddeleteById(UUID userId) Deletes a user by their ID.voiddeleteFestivalUser(UUID userId, UUID festivalId) Deletes a user's festival.voiddeleteSearchHistory(UUID userId) voiddeleteUserCity(UUID userId, UUID cityId) Deletes a user's city.voiddeleteUserViewHistory(UUID userId) Deletes the user's view history.doCreateAccountLink(UUID userId, AccountLinkToken.ExpectedService expectedService) voidemailUnsubscribe(UUID userId, String token) voidevictAllRecsCaches(UUID userId) Evicts all recommendation caches for a user.voidevictRecsCache(UUID userId, UUID cityId) Evicts the recommendation cache for a user and city.voidfavoriteArtist(UUID userId, UUID artistId) Favorites an artist for a user.voidfavoriteEvent(UUID userId, UUID eventId) Favorites an event for a user.voidfavoriteVenue(UUID userId, UUID venueId) Favorites a venue for a user.getCitiesResponse(UUID userId) Gets the user's cities.Gets a user's city.org.springframework.data.domain.Page<BasicArtistResponse>getFavoriteArtists(UUID userId, UserFavoriteQuery query) org.springframework.data.domain.Page<UserFavoriteEventResponse>getFavoriteEvents(UUID userId, UserFavoriteQuery query) org.springframework.data.domain.Page<UserFavoriteEventResponse>getFavoriteEventsPrevious(UUID userId, UserFavoriteQuery query) org.springframework.data.domain.Page<UserFavoriteEventResponse>getFavoriteEventsUpcoming(UUID userId, UserFavoriteQuery query) org.springframework.data.domain.Page<VenueResponse>getFavoriteVenues(UUID userId, UserFavoriteQuery query) getOrCreateFestivalPlaylist(UUID userId, UUID festivalId) getOrCreatePlaylist(UUID userId, UUID cityId) getPlaylist(UUID userId, UUID cityId) getSearchHistory(UUID userId) Gets the user's seed artists.getSeedsAll(UUID userId) Gets all of the user's seed artists, including blacklisted ones.getUserCitiesAndFestivals(UUID userId) Gets the user's cities and festivals.getUserResponse(UUID userId) Gets the user details response for a user.getUserViewHistory(UUID userId, PageOptions pageOptions) Gets the user's view history.patchById(UUID userId, UserPatchRequest request) Patches a user's information.patchCity(UUID userId, UUID cityId, UserCityPatchRequest request) Patches a user's city.putCity(UUID userId, UUID cityId, UserCityPutRequest request) Adds or updates a user's city.putCityOnboarding(UUID userId, UUID cityId, UserCityPutRequest request) Adds or updates a user's city during onboarding.putFestival(UUID userId, UUID festivalId) Adds or updates a user's festival.Sets the user's seed artists.voidrateEvent(UUID userId, UUID eventId, UserFavoriteEventRating rating) Rates an event for a user.voidsaveSearchQuery(String query, UUID actingUserId) Saves a search query.voidsubmitFeedback(UUID userId, String entry, String email) voidunblacklistSeed(UUID userId, UUID seedId) Un-blacklists a seed artist for a user.voidunfavoriteArtist(UUID userId, UUID artistId) Unfavorites an artist for a user.voidunfavoriteEvent(UUID userId, UUID eventId) Unfavorites an event for a user.voidunfavoriteVenue(UUID userId, UUID venueId) Unfavorites a venue for a user.
-
Constructor Details
-
UserServiceImpl
@Autowired public UserServiceImpl(UserRepository userRepository, UserCityRepository userCityRepository, CityRepository cityRepository, UserSeedRepository userSeedRepository, ArtistRepository artistRepository, ServletUtils servletUtils, UserFavoriteArtistRepository userFavoriteArtistRepository, UserSearchRepository userSearchRepository, EventRepository eventRepository, UserFavoriteEventRepository userFavoriteEventRepository, VenueRepository venueRepository, UserFavoriteVenueRepository userFavoriteVenueRepository, AccountLinkTokenRepository accountLinkTokenRepository, RecommendService recommender, PlaylistService playlistService, jakarta.persistence.EntityManager entityManager, UserRecentArtistViewRepository userRecentArtistViewRepository, UserRecentEventViewRepository userRecentEventViewRepository, UserRecentVenueViewRepository userRecentVenueViewRepository, ArtistCityRepository artistCityRepository, UserFeedbackRepository userFeedbackRepository, GoogleDispatch googleDispatch, LocalifyProperties properties, WeeklyEmailRegistrationTokenRepository weeklyEmailRegistrationTokenRepository, FestivalUserRepository festivalUserRepository, FestivalRepository festivalRepository) Constructs a new UserServiceImpl with the given repositories and services.- Parameters:
userRepository- The user repository.userCityRepository- The user city repository.cityRepository- The city repository.userSeedRepository- The user seed repository.artistRepository- The artist repository.servletUtils- The servlet utils.userFavoriteArtistRepository- The user favorite artist repository.userSearchRepository- The user search repository.eventRepository- The event repository.userFavoriteEventRepository- The user favorite event repository.venueRepository- The venue repository.userFavoriteVenueRepository- The user favorite venue repository.accountLinkTokenRepository- The account link token repository.recommender- The recommend service.playlistService- The playlist service.entityManager- The entity manager.userRecentArtistViewRepository- The user recent artist view repository.userRecentEventViewRepository- The user recent event view repository.userRecentVenueViewRepository- The user recent venue view repository.artistCityRepository- The artist city repository.userFeedbackRepository- The user feedback repository.googleDispatch- The google dispatch.properties- The localify properties.weeklyEmailRegistrationTokenRepository- The weekly email registration token repository.festivalUserRepository- The festival user repository.festivalRepository- The festival repository.
-
-
Method Details
-
getUserResponse
Description copied from interface:UserServiceGets the user details response for a user.- Specified by:
getUserResponsein interfaceUserService- Parameters:
userId- The ID of the user.- Returns:
- The user details response.
-
getUserViewHistory
Description copied from interface:UserServiceGets the user's view history.- Specified by:
getUserViewHistoryin interfaceUserService- Parameters:
userId- The ID of the user.pageOptions- The pagination options.- Returns:
- The user's view history.
-
deleteUserViewHistory
Description copied from interface:UserServiceDeletes the user's view history.- Specified by:
deleteUserViewHistoryin interfaceUserService- Parameters:
userId- The ID of the user.
-
patchById
Description copied from interface:UserServicePatches a user's information.- Specified by:
patchByIdin interfaceUserService- Parameters:
userId- The ID of the user.request- The patch request.- Returns:
- The updated user details response.
-
patchCity
@Transactional public UserCityContainer patchCity(UUID userId, UUID cityId, UserCityPatchRequest request) Description copied from interface:UserServicePatches a user's city.- Specified by:
patchCityin interfaceUserService- Parameters:
userId- The ID of the user.cityId- The ID of the city.request- The patch request.- Returns:
- The updated user city container.
-
putCity
@Transactional public UserCityContainer putCity(UUID userId, UUID cityId, UserCityPutRequest request) Description copied from interface:UserServiceAdds or updates a user's city.- Specified by:
putCityin interfaceUserService- Parameters:
userId- The ID of the user.cityId- The ID of the city.request- The put request.- Returns:
- The updated user city container.
-
putCityOnboarding
@Transactional public UserCityContainer putCityOnboarding(UUID userId, UUID cityId, UserCityPutRequest request) Description copied from interface:UserServiceAdds or updates a user's city during onboarding.- Specified by:
putCityOnboardingin interfaceUserService- Parameters:
userId- The ID of the user.cityId- The ID of the city.request- The put request.- Returns:
- The updated user city container.
-
putFestival
Description copied from interface:UserServiceAdds or updates a user's festival.- Specified by:
putFestivalin interfaceUserService- Parameters:
userId- The ID of the user.festivalId- The ID of the festival.- Returns:
- The festival response.
-
getSeeds
Description copied from interface:UserServiceGets the user's seed artists.- Specified by:
getSeedsin interfaceUserService- Parameters:
userId- The ID of the user.- Returns:
- A list of seed artist responses.
-
getSeedsAll
Description copied from interface:UserServiceGets all of the user's seed artists, including blacklisted ones.- Specified by:
getSeedsAllin interfaceUserService- Parameters:
userId- The ID of the user.- Returns:
- A list of seed artist responses.
-
getCitiesResponse
Description copied from interface:UserServiceGets the user's cities.- Specified by:
getCitiesResponsein interfaceUserService- Parameters:
userId- The ID of the user.- Returns:
- A response containing the user's cities.
-
getUserCitiesAndFestivals
@Transactional(readOnly=true) public UserCitiesFestivalsResponse getUserCitiesAndFestivals(UUID userId) Description copied from interface:UserServiceGets the user's cities and festivals.- Specified by:
getUserCitiesAndFestivalsin interfaceUserService- Parameters:
userId- The ID of the user.- Returns:
- A response containing the user's cities and festivals.
-
getCity
Description copied from interface:UserServiceGets a user's city.- Specified by:
getCityin interfaceUserService- Parameters:
userId- The ID of the user.cityId- The ID of the city.- Returns:
- The user city container.
-
deleteById
Description copied from interface:UserServiceDeletes a user by their ID.- Specified by:
deleteByIdin interfaceUserService- Parameters:
userId- The ID of the user.
-
blacklistSeed
Description copied from interface:UserServiceBlacklists a seed artist for a user.- Specified by:
blacklistSeedin interfaceUserService- Parameters:
userId- The ID of the user.seedId- The ID of the seed artist.
-
unblacklistSeed
Description copied from interface:UserServiceUn-blacklists a seed artist for a user.- Specified by:
unblacklistSeedin interfaceUserService- Parameters:
userId- The ID of the user.seedId- The ID of the seed artist.
-
putSeeds
Description copied from interface:UserServiceSets the user's seed artists.- Specified by:
putSeedsin interfaceUserService- Parameters:
userId- The ID of the user.seeds- A list of seed artist IDs.- Returns:
- A list of the updated seed artist responses.
-
addSeed
Description copied from interface:UserServiceAdds a seed artist for a user.- Specified by:
addSeedin interfaceUserService- Parameters:
userId- The ID of the user.seed- The ID of the seed artist to add.
-
createAnonymousUser
Description copied from interface:UserServiceCreates an anonymous user.- Specified by:
createAnonymousUserin interfaceUserService- Returns:
- The created user.
-
deleteUserCity
Description copied from interface:UserServiceDeletes a user's city.- Specified by:
deleteUserCityin interfaceUserService- Parameters:
userId- The ID of the user.cityId- The ID of the city.
-
deleteFestivalUser
Description copied from interface:UserServiceDeletes a user's festival.- Specified by:
deleteFestivalUserin interfaceUserService- Parameters:
userId- The ID of the user.festivalId- The ID of the festival.
-
favoriteArtist
Description copied from interface:UserServiceFavorites an artist for a user.- Specified by:
favoriteArtistin interfaceUserService- Parameters:
userId- The ID of the user.artistId- The ID of the artist.
-
unfavoriteArtist
Description copied from interface:UserServiceUnfavorites an artist for a user.- Specified by:
unfavoriteArtistin interfaceUserService- Parameters:
userId- The ID of the user.artistId- The ID of the artist.
-
favoriteEvent
Description copied from interface:UserServiceFavorites an event for a user.- Specified by:
favoriteEventin interfaceUserService- Parameters:
userId- The ID of the user.eventId- The ID of the event.
-
unfavoriteEvent
Description copied from interface:UserServiceUnfavorites an event for a user.- Specified by:
unfavoriteEventin interfaceUserService- Parameters:
userId- The ID of the user.eventId- The ID of the event.
-
rateEvent
Description copied from interface:UserServiceRates an event for a user.- Specified by:
rateEventin interfaceUserService- Parameters:
userId- The ID of the user.eventId- The ID of the event.rating- The rating.
-
favoriteVenue
Description copied from interface:UserServiceFavorites a venue for a user.- Specified by:
favoriteVenuein interfaceUserService- Parameters:
userId- The ID of the user.venueId- The ID of the venue.
-
unfavoriteVenue
Description copied from interface:UserServiceUnfavorites a venue for a user.- Specified by:
unfavoriteVenuein interfaceUserService- Parameters:
userId- The ID of the user.venueId- The ID of the venue.
-
saveSearchQuery
Description copied from interface:UserServiceSaves a search query.- Specified by:
saveSearchQueryin interfaceUserService- Parameters:
query- the user's query
-
getSearchHistory
- Specified by:
getSearchHistoryin interfaceUserService
-
deleteSearchHistory
- Specified by:
deleteSearchHistoryin interfaceUserService
-
getFavoriteArtists
public org.springframework.data.domain.Page<BasicArtistResponse> getFavoriteArtists(UUID userId, UserFavoriteQuery query) - Specified by:
getFavoriteArtistsin interfaceUserService
-
getFavoriteEvents
public org.springframework.data.domain.Page<UserFavoriteEventResponse> getFavoriteEvents(UUID userId, UserFavoriteQuery query) - Specified by:
getFavoriteEventsin interfaceUserService
-
getFavoriteEventsUpcoming
public org.springframework.data.domain.Page<UserFavoriteEventResponse> getFavoriteEventsUpcoming(UUID userId, UserFavoriteQuery query) - Specified by:
getFavoriteEventsUpcomingin interfaceUserService
-
getFavoriteEventsPrevious
public org.springframework.data.domain.Page<UserFavoriteEventResponse> getFavoriteEventsPrevious(UUID userId, UserFavoriteQuery query) - Specified by:
getFavoriteEventsPreviousin interfaceUserService
-
getFavoriteVenues
public org.springframework.data.domain.Page<VenueResponse> getFavoriteVenues(UUID userId, UserFavoriteQuery query) - Specified by:
getFavoriteVenuesin interfaceUserService
-
doCreateAccountLink
@Transactional public AccountLinkToken doCreateAccountLink(UUID userId, AccountLinkToken.ExpectedService expectedService) - Specified by:
doCreateAccountLinkin interfaceUserService
-
getOrCreatePlaylist
- Specified by:
getOrCreatePlaylistin interfaceUserService
-
getOrCreateFestivalPlaylist
- Specified by:
getOrCreateFestivalPlaylistin interfaceUserService
-
getPlaylist
- Specified by:
getPlaylistin interfaceUserService
-
submitFeedback
- Specified by:
submitFeedbackin interfaceUserService
-
evictAllRecsCaches
Evicts all recommendation caches for a user.- Parameters:
userId- The ID of the user.
-
evictRecsCache
@CacheEvict(value="recs", key="#userId.toString() + #cityId.toString()") public void evictRecsCache(UUID userId, UUID cityId) Evicts the recommendation cache for a user and city.- Parameters:
userId- The ID of the user.cityId- The ID of the city.
-
canRecommend
- Specified by:
canRecommendin interfaceUserService
-
emailUnsubscribe
- Specified by:
emailUnsubscribein interfaceUserService
-