Package io.manebot.database.model
Class User
- java.lang.Object
-
- io.manebot.database.model.TimedRow
-
- io.manebot.database.model.User
-
- All Implemented Interfaces:
EntityType
,User
@Entity public class User extends TimedRow implements User
-
-
Method Summary
Modifier and Type Method Description UserBan
ban(java.lang.String reason)
Bans the user until the specified dateUserBan
ban(java.lang.String reason, java.util.Date date)
Bans the user until the specified datejava.util.Collection<ChatMessage>
broadcastMessage(java.util.function.Function<ChatSender,java.util.Collection<ChatMessage>> receiver)
Broadcasts the specified message receiver to the user.UserAssociation
createAssociation(Platform platform, java.lang.String platformUserId)
Creates a user connection for this user.java.util.Collection<UserAssociation>
getAssociations()
Get a list of connections that associate this user with platforms.UserBan
getBan()
Gets the current ban on record for the user.java.util.Collection<UserBan>
getBans()
Gets a list of all previous bans on record for this user.java.lang.String
getDisplayName()
Gets this user's desired display name.Entity
getEntity()
Gets the entity associated with this object.java.util.Collection<UserBan>
getIssuedBans()
Gets a list of all previous bans issued by this user.java.util.Date
getLastSeenDate()
Gets the date this user was last seen.java.util.Collection<UserGroupMembership>
getMembership()
Gets a collection of individual memberships, which is more definite than getUsers(), providing more specific information about membership.io.manebot.database.model.User.Prompt
getPrompt()
Gets the current user prompt.java.util.Date
getRegisteredDate()
Gets the date this user was registered.UserType
getType()
Gets the user's system type.UserAssociation
getUserAssociation(Platform platform, java.lang.String id)
Gets a user association by platform and ID.int
getUserId()
java.lang.String
getUsername()
Gets this user's username on the system.int
hashCode()
boolean
hasPermission(Permission permission, Grant fallback)
Finds if this entity has a specific permissionUserPrompt
prompt(java.util.function.Consumer<UserPrompt.Builder> consumer)
Constructs and assigns a user prompt for this user.boolean
removeAssociation(Platform platform, java.lang.String platformUserId)
Removes a user association from this user.void
setDisplayName(java.lang.String displayName)
Sets this user's desired display name.void
setLastSeen(int lastSeen)
void
setLastSeenDate(java.util.Date date)
Sets the last date this user was seen.boolean
setType(UserType userType)
Changes the user's system type.-
Methods inherited from class io.manebot.database.model.TimedRow
getCreated, getCreatedDate, getUpdated, getUpdatedDate, setCreated, setCreated, setCreatedDate, setUpdated, setUpdated, setUpdatedDate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.manebot.entity.EntityType
checkPermission, checkPermission, checkPermission, checkPermission, hasPermission, hasPermission, hasPermission
-
Methods inherited from interface io.manebot.user.User
addGroup, createSender, getAssociations, getGroups, getName, removeAssociation, removeGroup
-
-
-
-
Method Detail
-
getDisplayName
public java.lang.String getDisplayName()
Description copied from interface:User
Gets this user's desired display name.- Specified by:
getDisplayName
in interfaceUser
- Returns:
- Display name.
-
getRegisteredDate
public java.util.Date getRegisteredDate()
Description copied from interface:User
Gets the date this user was registered.- Specified by:
getRegisteredDate
in interfaceUser
- Returns:
- Register date.
-
getLastSeenDate
public java.util.Date getLastSeenDate()
Description copied from interface:User
Gets the date this user was last seen.- Specified by:
getLastSeenDate
in interfaceUser
- Returns:
- Last seen date.
-
setLastSeenDate
public void setLastSeenDate(java.util.Date date)
Description copied from interface:User
Sets the last date this user was seen.- Specified by:
setLastSeenDate
in interfaceUser
- Parameters:
date
- last seen date.
-
getMembership
public java.util.Collection<UserGroupMembership> getMembership()
Description copied from interface:User
Gets a collection of individual memberships, which is more definite than getUsers(), providing more specific information about membership.- Specified by:
getMembership
in interfaceUser
- Returns:
- immutable collection of user group membership records.
-
setDisplayName
public void setDisplayName(java.lang.String displayName) throws java.lang.IllegalArgumentException
Description copied from interface:User
Sets this user's desired display name.- Specified by:
setDisplayName
in interfaceUser
- Parameters:
displayName
- Display name.- Throws:
java.lang.IllegalArgumentException
-
getUsername
public java.lang.String getUsername()
Description copied from interface:User
Gets this user's username on the system.- Specified by:
getUsername
in interfaceUser
- Returns:
- Username.
-
getUserId
public int getUserId()
-
setLastSeen
public void setLastSeen(int lastSeen)
-
getEntity
public Entity getEntity()
Description copied from interface:EntityType
Gets the entity associated with this object.- Specified by:
getEntity
in interfaceEntityType
- Returns:
- Associated entity.
-
getUserAssociation
public UserAssociation getUserAssociation(Platform platform, java.lang.String id)
Description copied from interface:User
Gets a user association by platform and ID.- Specified by:
getUserAssociation
in interfaceUser
- Parameters:
platform
- Platform to search forid
- ID to search for.- Returns:
- UserAssociation instance if found, null otherwise.
-
getAssociations
public java.util.Collection<UserAssociation> getAssociations()
Description copied from interface:User
Get a list of connections that associate this user with platforms.- Specified by:
getAssociations
in interfaceUser
- Returns:
- user associations.
-
getBans
public java.util.Collection<UserBan> getBans()
Description copied from interface:User
Gets a list of all previous bans on record for this user.
-
getIssuedBans
public java.util.Collection<UserBan> getIssuedBans()
Description copied from interface:User
Gets a list of all previous bans issued by this user.- Specified by:
getIssuedBans
in interfaceUser
- Returns:
- immutable collection of user ban issuance history.
-
getBan
public UserBan getBan()
Description copied from interface:User
Gets the current ban on record for the user.
-
ban
public UserBan ban(java.lang.String reason, java.util.Date date) throws java.lang.SecurityException
Description copied from interface:User
Bans the user until the specified date
-
ban
public UserBan ban(java.lang.String reason) throws java.lang.SecurityException
Description copied from interface:User
Bans the user until the specified date
-
createAssociation
public UserAssociation createAssociation(Platform platform, java.lang.String platformUserId)
Description copied from interface:User
Creates a user connection for this user.- Specified by:
createAssociation
in interfaceUser
- Parameters:
platform
- Platform to create the association on.platformUserId
- Platform-specific ID to associate the connection to.- Returns:
- UserAssociation instance.
-
removeAssociation
public boolean removeAssociation(Platform platform, java.lang.String platformUserId)
Description copied from interface:User
Removes a user association from this user.- Specified by:
removeAssociation
in interfaceUser
- Parameters:
platform
- Platform to remove an association for.platformUserId
- Platform-specific id to remove an association for.- Returns:
- true if the association was removed, false otherwise.
-
getType
public UserType getType()
Description copied from interface:User
Gets the user's system type.
-
setType
public boolean setType(UserType userType)
Description copied from interface:User
Changes the user's system type.
-
broadcastMessage
public java.util.Collection<ChatMessage> broadcastMessage(java.util.function.Function<ChatSender,java.util.Collection<ChatMessage>> receiver)
Description copied from interface:User
Broadcasts the specified message receiver to the user.- Specified by:
broadcastMessage
in interfaceUser
- Parameters:
receiver
- ChatSender to broadcast, constructing messages for each broadcast endpoint for the user.- Returns:
- collection of all broadcast messages.
-
getPrompt
public io.manebot.database.model.User.Prompt getPrompt()
Description copied from interface:User
Gets the current user prompt.
-
prompt
public UserPrompt prompt(java.util.function.Consumer<UserPrompt.Builder> consumer) throws java.lang.IllegalStateException
Description copied from interface:User
Constructs and assigns a user prompt for this user. UserPrompts are completed on the thread of the user after they have been manually confirmed by the target user.
-
hasPermission
public boolean hasPermission(Permission permission, Grant fallback)
Description copied from interface:EntityType
Finds if this entity has a specific permission- Specified by:
hasPermission
in interfaceEntityType
- Parameters:
permission
- Permission to check for.- Returns:
- true if the permission is granted, false otherwise.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-