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

      public UserDetailsResponse getUserResponse(UUID userId)
      Description copied from interface: UserService
      Gets the user details response for a user.
      Specified by:
      getUserResponse in interface UserService
      Parameters:
      userId - The ID of the user.
      Returns:
      The user details response.
    • getUserViewHistory

      public UserHistoryResponse getUserViewHistory(UUID userId, PageOptions pageOptions)
      Description copied from interface: UserService
      Gets the user's view history.
      Specified by:
      getUserViewHistory in interface UserService
      Parameters:
      userId - The ID of the user.
      pageOptions - The pagination options.
      Returns:
      The user's view history.
    • deleteUserViewHistory

      public void deleteUserViewHistory(UUID userId)
      Description copied from interface: UserService
      Deletes the user's view history.
      Specified by:
      deleteUserViewHistory in interface UserService
      Parameters:
      userId - The ID of the user.
    • patchById

      @Transactional public UserDetailsResponse patchById(UUID userId, UserPatchRequest request)
      Description copied from interface: UserService
      Patches a user's information.
      Specified by:
      patchById in interface UserService
      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: UserService
      Patches a user's city.
      Specified by:
      patchCity in interface UserService
      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: UserService
      Adds or updates a user's city.
      Specified by:
      putCity in interface UserService
      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: UserService
      Adds or updates a user's city during onboarding.
      Specified by:
      putCityOnboarding in interface UserService
      Parameters:
      userId - The ID of the user.
      cityId - The ID of the city.
      request - The put request.
      Returns:
      The updated user city container.
    • putFestival

      @Transactional public FestivalResponse putFestival(UUID userId, UUID festivalId)
      Description copied from interface: UserService
      Adds or updates a user's festival.
      Specified by:
      putFestival in interface UserService
      Parameters:
      userId - The ID of the user.
      festivalId - The ID of the festival.
      Returns:
      The festival response.
    • getSeeds

      public List<SeedArtistResponse> getSeeds(UUID userId)
      Description copied from interface: UserService
      Gets the user's seed artists.
      Specified by:
      getSeeds in interface UserService
      Parameters:
      userId - The ID of the user.
      Returns:
      A list of seed artist responses.
    • getSeedsAll

      public List<SeedArtistResponse> getSeedsAll(UUID userId)
      Description copied from interface: UserService
      Gets all of the user's seed artists, including blacklisted ones.
      Specified by:
      getSeedsAll in interface UserService
      Parameters:
      userId - The ID of the user.
      Returns:
      A list of seed artist responses.
    • getCitiesResponse

      public UserCitiesResponse getCitiesResponse(UUID userId)
      Description copied from interface: UserService
      Gets the user's cities.
      Specified by:
      getCitiesResponse in interface UserService
      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: UserService
      Gets the user's cities and festivals.
      Specified by:
      getUserCitiesAndFestivals in interface UserService
      Parameters:
      userId - The ID of the user.
      Returns:
      A response containing the user's cities and festivals.
    • getCity

      public UserCityContainer getCity(UUID userId, UUID cityId)
      Description copied from interface: UserService
      Gets a user's city.
      Specified by:
      getCity in interface UserService
      Parameters:
      userId - The ID of the user.
      cityId - The ID of the city.
      Returns:
      The user city container.
    • deleteById

      @Transactional public void deleteById(UUID userId)
      Description copied from interface: UserService
      Deletes a user by their ID.
      Specified by:
      deleteById in interface UserService
      Parameters:
      userId - The ID of the user.
    • blacklistSeed

      @Transactional public void blacklistSeed(UUID userId, UUID seedId)
      Description copied from interface: UserService
      Blacklists a seed artist for a user.
      Specified by:
      blacklistSeed in interface UserService
      Parameters:
      userId - The ID of the user.
      seedId - The ID of the seed artist.
    • unblacklistSeed

      @Transactional public void unblacklistSeed(UUID userId, UUID seedId)
      Description copied from interface: UserService
      Un-blacklists a seed artist for a user.
      Specified by:
      unblacklistSeed in interface UserService
      Parameters:
      userId - The ID of the user.
      seedId - The ID of the seed artist.
    • putSeeds

      @Transactional public List<SeedArtistResponse> putSeeds(UUID userId, List<UUID> seeds)
      Description copied from interface: UserService
      Sets the user's seed artists.
      Specified by:
      putSeeds in interface UserService
      Parameters:
      userId - The ID of the user.
      seeds - A list of seed artist IDs.
      Returns:
      A list of the updated seed artist responses.
    • addSeed

      @Transactional public void addSeed(UUID userId, UUID seed)
      Description copied from interface: UserService
      Adds a seed artist for a user.
      Specified by:
      addSeed in interface UserService
      Parameters:
      userId - The ID of the user.
      seed - The ID of the seed artist to add.
    • createAnonymousUser

      @Transactional public User createAnonymousUser()
      Description copied from interface: UserService
      Creates an anonymous user.
      Specified by:
      createAnonymousUser in interface UserService
      Returns:
      The created user.
    • deleteUserCity

      @Transactional public void deleteUserCity(UUID userId, UUID cityId)
      Description copied from interface: UserService
      Deletes a user's city.
      Specified by:
      deleteUserCity in interface UserService
      Parameters:
      userId - The ID of the user.
      cityId - The ID of the city.
    • deleteFestivalUser

      @Transactional public void deleteFestivalUser(UUID userId, UUID festivalId)
      Description copied from interface: UserService
      Deletes a user's festival.
      Specified by:
      deleteFestivalUser in interface UserService
      Parameters:
      userId - The ID of the user.
      festivalId - The ID of the festival.
    • favoriteArtist

      @Transactional public void favoriteArtist(UUID userId, UUID artistId)
      Description copied from interface: UserService
      Favorites an artist for a user.
      Specified by:
      favoriteArtist in interface UserService
      Parameters:
      userId - The ID of the user.
      artistId - The ID of the artist.
    • unfavoriteArtist

      @Transactional public void unfavoriteArtist(UUID userId, UUID artistId)
      Description copied from interface: UserService
      Unfavorites an artist for a user.
      Specified by:
      unfavoriteArtist in interface UserService
      Parameters:
      userId - The ID of the user.
      artistId - The ID of the artist.
    • favoriteEvent

      @Transactional public void favoriteEvent(UUID userId, UUID eventId)
      Description copied from interface: UserService
      Favorites an event for a user.
      Specified by:
      favoriteEvent in interface UserService
      Parameters:
      userId - The ID of the user.
      eventId - The ID of the event.
    • unfavoriteEvent

      @Transactional public void unfavoriteEvent(UUID userId, UUID eventId)
      Description copied from interface: UserService
      Unfavorites an event for a user.
      Specified by:
      unfavoriteEvent in interface UserService
      Parameters:
      userId - The ID of the user.
      eventId - The ID of the event.
    • rateEvent

      @Transactional public void rateEvent(UUID userId, UUID eventId, UserFavoriteEventRating rating)
      Description copied from interface: UserService
      Rates an event for a user.
      Specified by:
      rateEvent in interface UserService
      Parameters:
      userId - The ID of the user.
      eventId - The ID of the event.
      rating - The rating.
    • favoriteVenue

      @Transactional public void favoriteVenue(UUID userId, UUID venueId)
      Description copied from interface: UserService
      Favorites a venue for a user.
      Specified by:
      favoriteVenue in interface UserService
      Parameters:
      userId - The ID of the user.
      venueId - The ID of the venue.
    • unfavoriteVenue

      @Transactional public void unfavoriteVenue(UUID userId, UUID venueId)
      Description copied from interface: UserService
      Unfavorites a venue for a user.
      Specified by:
      unfavoriteVenue in interface UserService
      Parameters:
      userId - The ID of the user.
      venueId - The ID of the venue.
    • saveSearchQuery

      @Transactional public void saveSearchQuery(String query, UUID actingUserId)
      Description copied from interface: UserService
      Saves a search query.
      Specified by:
      saveSearchQuery in interface UserService
      Parameters:
      query - the user's query
    • getSearchHistory

      public List<String> getSearchHistory(UUID userId)
      Specified by:
      getSearchHistory in interface UserService
    • deleteSearchHistory

      @Transactional public void deleteSearchHistory(UUID userId)
      Specified by:
      deleteSearchHistory in interface UserService
    • getFavoriteArtists

      public org.springframework.data.domain.Page<BasicArtistResponse> getFavoriteArtists(UUID userId, UserFavoriteQuery query)
      Specified by:
      getFavoriteArtists in interface UserService
    • getFavoriteEvents

      public org.springframework.data.domain.Page<UserFavoriteEventResponse> getFavoriteEvents(UUID userId, UserFavoriteQuery query)
      Specified by:
      getFavoriteEvents in interface UserService
    • getFavoriteEventsUpcoming

      public org.springframework.data.domain.Page<UserFavoriteEventResponse> getFavoriteEventsUpcoming(UUID userId, UserFavoriteQuery query)
      Specified by:
      getFavoriteEventsUpcoming in interface UserService
    • getFavoriteEventsPrevious

      public org.springframework.data.domain.Page<UserFavoriteEventResponse> getFavoriteEventsPrevious(UUID userId, UserFavoriteQuery query)
      Specified by:
      getFavoriteEventsPrevious in interface UserService
    • getFavoriteVenues

      public org.springframework.data.domain.Page<VenueResponse> getFavoriteVenues(UUID userId, UserFavoriteQuery query)
      Specified by:
      getFavoriteVenues in interface UserService
    • doCreateAccountLink

      @Transactional public AccountLinkToken doCreateAccountLink(UUID userId, AccountLinkToken.ExpectedService expectedService)
      Specified by:
      doCreateAccountLink in interface UserService
    • getOrCreatePlaylist

      @Transactional public PlaylistDto getOrCreatePlaylist(UUID userId, UUID cityId)
      Specified by:
      getOrCreatePlaylist in interface UserService
    • getOrCreateFestivalPlaylist

      @Transactional public PlaylistDto getOrCreateFestivalPlaylist(UUID userId, UUID festivalId)
      Specified by:
      getOrCreateFestivalPlaylist in interface UserService
    • getPlaylist

      @Transactional public PlaylistDto getPlaylist(UUID userId, UUID cityId)
      Specified by:
      getPlaylist in interface UserService
    • submitFeedback

      @Transactional public void submitFeedback(UUID userId, String entry, String email)
      Specified by:
      submitFeedback in interface UserService
    • evictAllRecsCaches

      public void evictAllRecsCaches(UUID userId)
      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

      public void canRecommend(UUID userId)
      Specified by:
      canRecommend in interface UserService
    • emailUnsubscribe

      @Transactional public void emailUnsubscribe(UUID userId, String token)
      Specified by:
      emailUnsubscribe in interface UserService