Package org.localify.user
Class User
java.lang.Object
org.localify.user.User
Represents a user.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the account creation date.copySimpleDetails(User other) Copies simple details from another user object to this one.voidDisables the user's account.booleanChecks if the user's email is eligible to be changed.voidEnables the user's account.Gets the user's Apple Music ID.Gets the user's Apple Music token.Gets the user's cities.Gets the name to display for contributions.Gets the timestamp when the user was banned from making contributions.Gets the creation timestamp.Gets the deleted timestamp.Gets the user's Google ID.Gets the user's Google profile picture URL.getId()Gets the user's ID.Gets the user's legacy ID.Gets the user's Localify profile picture URL.getName()Gets the name of the user.Gets the user's preference for playlist generation.Gets the number of local songs to include per seed artist in playlists.Gets the user's preference for using seed songs in playlists.Gets the user's signup IP address.Gets the user's Spotify access token.Gets the expiration time of the user's Spotify access token.com.neovisionaries.i18n.CountryCodeGets the user's Spotify country code.Gets the user's Spotify ID.Gets the user's Spotify profile picture URL.Gets the user's Spotify refresh token.Gets the user's Spotify username.Gets the user's trust score.Gets the last update timestamp.Gets the user's email address.Gets the user's verified artist.voidHides the user's contributions.booleanisAdmin()Checks if the user is an admin.booleanChecks if the user has an Apple Music account connected.booleanChecks if the user is disabled.booleanChecks if the user has an email connected.booleanChecks if the user has opted in to emails.booleanChecks if the user's email is verified.booleanisGuest()Checks if the user is a guest.booleanChecks if the user's contributions are hidden.booleanChecks if the user is hiding their contributions.booleanChecks if the user has a Spotify account connected.booleanChecks if the user is a super admin.booleanChecks if the user is a team member.booleanChecks if the user's name is eligible to be automatically changed.static UsernewGuestUser(InetAddress ipAddress) Creates a new guest user.static UsernewUser(String name, InetAddress ipAddress) Creates a new user.voidOpts the user in to emails.voidOpts the user out of emails.voidProcesses a Google JWT user details object and updates the user's information.Processes a Spotify user details object and updates the user's information.voidRemoves all personal data associated with a user.voidsetAdmin(boolean admin) Sets whether the user is an admin.voidsetAppleId(String appleId) Sets the user's Apple Music ID.voidsetAppleMusicToken(String appleMusicToken) Sets the user's Apple Music token.voidSets the user's cities.voidsetContributionBannedAt(Instant contributionBannedAt) Sets the timestamp when the user was banned from making contributions.voidsetCreatedAt(Instant createdAt) Sets the creation timestamp.voidsetDeletedAt(Instant deletedAt) Sets the deleted timestamp.voidsetDisabled(boolean disabled) Sets whether the user is disabled.voidsetEmailOptIn(boolean emailOptIn) Sets whether the user has opted in to emails.voidsetEmailVerified(boolean emailVerified) Sets whether the user's email is verified.voidsetGoogleId(String googleId) Sets the user's Google ID.voidsetGooglePictureUrl(String googlePictureUrl) Sets the user's Google profile picture URL.voidsetGuest(boolean guest) Sets whether the user is a guest.voidsetHideContributed(boolean hideContributed) Sets whether to hide the user's contributions.voidSets the user's ID.voidsetLegacyId(Integer legacyId) Sets the user's legacy ID.voidSets the name of the user.voidsetPlaylistGeneration(Boolean playlistGeneration) Sets the user's preference for playlist generation.voidsetPlaylistLocalSongsPerSeed(Integer playlistLocalSongsPerSeed) Sets the number of local songs to include per seed artist in playlists.voidsetPlaylistUseSeedSongs(Boolean playlistUseSeedSongs) Sets the user's preference for using seed songs in playlists.voidsetSignupIp(InetAddress signupIp) Sets the user's signup IP address.voidsetSpotifyAccessToken(String spotifyAccessToken) Sets the user's Spotify access token.voidsetSpotifyAccessTokenExpiresAt(Instant spotifyAccessTokenExpiresAt) Sets the expiration time of the user's Spotify access token.voidsetSpotifyCountryCode(com.neovisionaries.i18n.CountryCode spotifyCountryCode) Sets the user's Spotify country code.voidsetSpotifyId(String spotifyId) Sets the user's Spotify ID.voidsetSpotifyProfilePicture(String spotifyProfilePicture) Sets the user's Spotify profile picture URL.voidsetSpotifyRefreshToken(String spotifyRefreshToken) Sets the user's Spotify refresh token.voidsetSpotifyUsername(String spotifyUsername) Sets the user's Spotify username.voidsetSuperAdmin(boolean superAdmin) Sets whether the user is a super admin.voidsetTeamMember(boolean teamMember) Sets whether the user is a team member.voidsetTrustScore(Double trustScore) Sets the user's trust score.voidsetUpdatedAt(Instant updatedAt) Sets the last update timestamp.voidsetUserEmail(String userEmail) Sets the user's email address.voidsetVerifiedArtist(Artist verifiedArtist) Sets the verified artist for the user.voidsetVerifiedEmail(String verifiedEmail) Sets the user's email as verified.voidShows the user's contributions.booleanChecks if the user's Spotify credentials are invalid.Converts the user to a response DTO.Converts the user to a user details DTO for authentication purposes.voidupdateSpotifyCredentials(se.michaelthelin.spotify.model_objects.credentials.AuthorizationCodeCredentials spotifyCreds) Updates the user's Spotify credentials.
-
Constructor Details
-
User
protected User()Protected no-arg constructor for JPA.
-
-
Method Details
-
isEmailConnected
public boolean isEmailConnected()Checks if the user has an email connected.- Returns:
- true if an email is connected, false otherwise.
-
isAppleConnected
public boolean isAppleConnected()Checks if the user has an Apple Music account connected.- Returns:
- true if an Apple Music account is connected, false otherwise.
-
isSpotifyConnected
public boolean isSpotifyConnected()Checks if the user has a Spotify account connected.- Returns:
- true if a Spotify account is connected, false otherwise.
-
getContributionBannedAt
Gets the timestamp when the user was banned from making contributions.- Returns:
- The contribution banned timestamp.
-
setContributionBannedAt
Sets the timestamp when the user was banned from making contributions.- Parameters:
contributionBannedAt- The contribution banned timestamp.
-
getSpotifyUsername
Gets the user's Spotify username.- Returns:
- The Spotify username.
-
setSpotifyUsername
Sets the user's Spotify username.- Parameters:
spotifyUsername- The Spotify username.
-
processGoogleContainer
Processes a Google JWT user details object and updates the user's information.- Parameters:
details- The Google JWT user details.
-
updateSpotifyCredentials
public void updateSpotifyCredentials(se.michaelthelin.spotify.model_objects.credentials.AuthorizationCodeCredentials spotifyCreds) Updates the user's Spotify credentials.- Parameters:
spotifyCreds- The new Spotify credentials.
-
processSpotifyContainer
Processes a Spotify user details object and updates the user's information.- Parameters:
details- The Spotify user details.- Returns:
- This User instance.
-
copySimpleDetails
Copies simple details from another user object to this one.- Parameters:
other- The other user object.- Returns:
- This User instance.
-
nameEligibleToBeAutoChanged
public boolean nameEligibleToBeAutoChanged()Checks if the user's name is eligible to be automatically changed.- Returns:
- true if the name is eligible, false otherwise.
-
emailEligibleToBeChanged
public boolean emailEligibleToBeChanged()Checks if the user's email is eligible to be changed.- Returns:
- true if the email is eligible, false otherwise.
-
setVerifiedEmail
Sets the user's email as verified.- Parameters:
verifiedEmail- The verified email address.
-
newGuestUser
Creates a new guest user.- Parameters:
ipAddress- The IP address of the user.- Returns:
- The new guest user.
-
newUser
Creates a new user.- Parameters:
name- The name of the user.ipAddress- The IP address of the user.- Returns:
- The new user.
-
toResponse
Converts the user to a response DTO.- Returns:
- The user details response DTO.
-
spotifyCredentialsInvalid
public boolean spotifyCredentialsInvalid()Checks if the user's Spotify credentials are invalid.- Returns:
- true if the credentials are invalid, false otherwise.
-
toUserDetailsDto
Converts the user to a user details DTO for authentication purposes.- Returns:
- The user details DTO.
-
isEmailVerified
public boolean isEmailVerified()Checks if the user's email is verified.- Returns:
- true if the email is verified, false otherwise.
-
isEmailOptIn
public boolean isEmailOptIn()Checks if the user has opted in to emails.- Returns:
- true if the user has opted in, false otherwise.
-
setEmailOptIn
public void setEmailOptIn(boolean emailOptIn) Sets whether the user has opted in to emails.- Parameters:
emailOptIn- true if the user has opted in, false otherwise.
-
setHideContributed
public void setHideContributed(boolean hideContributed) Sets whether to hide the user's contributions.- Parameters:
hideContributed- true to hide contributions, false otherwise.
-
isGuest
public boolean isGuest()Checks if the user is a guest.- Returns:
- true if the user is a guest, false otherwise.
-
setGuest
public void setGuest(boolean guest) Sets whether the user is a guest.- Parameters:
guest- true if the user is a guest, false otherwise.
-
setVerifiedArtist
Sets the verified artist for the user.- Parameters:
verifiedArtist- The verified artist.
-
setDisabled
public void setDisabled(boolean disabled) Sets whether the user is disabled.- Parameters:
disabled- true if the user is disabled, false otherwise.
-
setAdmin
public void setAdmin(boolean admin) Sets whether the user is an admin.- Parameters:
admin- true if the user is an admin, false otherwise.
-
setSuperAdmin
public void setSuperAdmin(boolean superAdmin) Sets whether the user is a super admin.- Parameters:
superAdmin- true if the user is a super admin, false otherwise.
-
setTeamMember
public void setTeamMember(boolean teamMember) Sets whether the user is a team member.- Parameters:
teamMember- true if the user is a team member, false otherwise.
-
accountCreationDate
Gets the account creation date.- Returns:
- The account creation date.
-
getName
Gets the name of the user.- Returns:
- The user's name.
-
setName
Sets the name of the user.- Parameters:
name- The user's name.
-
getUserEmail
Gets the user's email address.- Returns:
- The email address.
-
setUserEmail
Sets the user's email address.- Parameters:
userEmail- The email address.
-
optEmailIn
public void optEmailIn()Opts the user in to emails. -
optEmailOut
public void optEmailOut()Opts the user out of emails. -
getCreatedAt
Gets the creation timestamp.- Returns:
- The creation timestamp.
-
getUpdatedAt
Gets the last update timestamp.- Returns:
- The last update timestamp.
-
getDeletedAt
Gets the deleted timestamp.- Returns:
- The deleted timestamp.
-
getSpotifyId
Gets the user's Spotify ID.- Returns:
- The Spotify ID.
-
setSpotifyId
Sets the user's Spotify ID.- Parameters:
spotifyId- The Spotify ID.
-
getId
Gets the user's ID.- Returns:
- The user ID.
-
disableUser
public void disableUser()Disables the user's account. -
enableUser
public void enableUser()Enables the user's account. -
getCities
Gets the user's cities.- Returns:
- A list of user cities.
-
getSignupIp
Gets the user's signup IP address.- Returns:
- The signup IP address.
-
getGoogleId
Gets the user's Google ID.- Returns:
- The Google ID.
-
setGoogleId
Sets the user's Google ID.- Parameters:
googleId- The Google ID.
-
getVerifiedArtist
Gets the user's verified artist.- Returns:
- The verified artist.
-
setEmailVerified
public void setEmailVerified(boolean emailVerified) Sets whether the user's email is verified.- Parameters:
emailVerified- true if the email is verified, false otherwise.
-
getGooglePictureUrl
Gets the user's Google profile picture URL.- Returns:
- The Google profile picture URL.
-
getSpotifyCountryCode
public com.neovisionaries.i18n.CountryCode getSpotifyCountryCode()Gets the user's Spotify country code.- Returns:
- The Spotify country code.
-
getSpotifyProfilePicture
Gets the user's Spotify profile picture URL.- Returns:
- The Spotify profile picture URL.
-
getSpotifyAccessToken
Gets the user's Spotify access token.- Returns:
- The Spotify access token.
-
getSpotifyRefreshToken
Gets the user's Spotify refresh token.- Returns:
- The Spotify refresh token.
-
getSpotifyAccessTokenExpiresAt
Gets the expiration time of the user's Spotify access token.- Returns:
- The expiration time.
-
getLegacyId
Gets the user's legacy ID.- Returns:
- The legacy ID.
-
setLegacyId
Sets the user's legacy ID.- Parameters:
legacyId- The legacy ID.
-
getTrustScore
Gets the user's trust score.- Returns:
- The trust score.
-
setTrustScore
Sets the user's trust score.- Parameters:
trustScore- The trust score.
-
hideContributed
public void hideContributed()Hides the user's contributions. -
showContributed
public void showContributed()Shows the user's contributions. -
isHideContributed
public boolean isHideContributed()Checks if the user's contributions are hidden.- Returns:
- true if contributions are hidden, false otherwise.
-
getAppleMusicToken
Gets the user's Apple Music token.- Returns:
- The Apple Music token.
-
setAppleMusicToken
Sets the user's Apple Music token.- Parameters:
appleMusicToken- The Apple Music token.
-
isHidingContributed
public boolean isHidingContributed()Checks if the user is hiding their contributions.- Returns:
- true if contributions are hidden, false otherwise.
-
getContributedName
Gets the name to display for contributions.- Returns:
- The contribution name.
-
setId
Sets the user's ID.- Parameters:
id- The user ID.
-
setSignupIp
Sets the user's signup IP address.- Parameters:
signupIp- The signup IP address.
-
setCreatedAt
Sets the creation timestamp.- Parameters:
createdAt- The creation timestamp.
-
setUpdatedAt
Sets the last update timestamp.- Parameters:
updatedAt- The last update timestamp.
-
setDeletedAt
Sets the deleted timestamp.- Parameters:
deletedAt- The deleted timestamp.
-
setGooglePictureUrl
Sets the user's Google profile picture URL.- Parameters:
googlePictureUrl- The Google profile picture URL.
-
setSpotifyCountryCode
public void setSpotifyCountryCode(com.neovisionaries.i18n.CountryCode spotifyCountryCode) Sets the user's Spotify country code.- Parameters:
spotifyCountryCode- The Spotify country code.
-
setSpotifyProfilePicture
Sets the user's Spotify profile picture URL.- Parameters:
spotifyProfilePicture- The Spotify profile picture URL.
-
setSpotifyAccessToken
Sets the user's Spotify access token.- Parameters:
spotifyAccessToken- The Spotify access token.
-
setSpotifyRefreshToken
Sets the user's Spotify refresh token.- Parameters:
spotifyRefreshToken- The Spotify refresh token.
-
setSpotifyAccessTokenExpiresAt
Sets the expiration time of the user's Spotify access token.- Parameters:
spotifyAccessTokenExpiresAt- The expiration time.
-
setCities
Sets the user's cities.- Parameters:
cities- A list of user cities.
-
getAppleId
Gets the user's Apple Music ID.- Returns:
- The Apple Music ID.
-
setAppleId
Sets the user's Apple Music ID.- Parameters:
appleId- The Apple Music ID.
-
isDisabled
public boolean isDisabled()Checks if the user is disabled.- Returns:
- true if the user is disabled, false otherwise.
-
isAdmin
public boolean isAdmin()Checks if the user is an admin.- Returns:
- true if the user is an admin, false otherwise.
-
isSuperAdmin
public boolean isSuperAdmin()Checks if the user is a super admin.- Returns:
- true if the user is a super admin, false otherwise.
-
isTeamMember
public boolean isTeamMember()Checks if the user is a team member.- Returns:
- true if the user is a team member, false otherwise.
-
getPlaylistUseSeedSongs
Gets the user's preference for using seed songs in playlists.- Returns:
- The user's preference.
-
setPlaylistUseSeedSongs
Sets the user's preference for using seed songs in playlists.- Parameters:
playlistUseSeedSongs- The user's preference.
-
getPlaylistLocalSongsPerSeed
Gets the number of local songs to include per seed artist in playlists.- Returns:
- The number of local songs per seed.
-
setPlaylistLocalSongsPerSeed
Sets the number of local songs to include per seed artist in playlists.- Parameters:
playlistLocalSongsPerSeed- The number of local songs per seed.
-
getPlaylistGeneration
Gets the user's preference for playlist generation.- Returns:
- The user's preference.
-
setPlaylistGeneration
Sets the user's preference for playlist generation.- Parameters:
playlistGeneration- The user's preference.
-
removeUserData
public void removeUserData()Removes all personal data associated with a user. -
getLocalifyProfilePicture
Gets the user's Localify profile picture URL.- Returns:
- The profile picture URL.
-