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 UserBanban(java.lang.String reason)Bans the user until the specified dateUserBanban(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.UserAssociationcreateAssociation(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.UserBangetBan()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.StringgetDisplayName()Gets this user's desired display name.EntitygetEntity()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.DategetLastSeenDate()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.PromptgetPrompt()Gets the current user prompt.java.util.DategetRegisteredDate()Gets the date this user was registered.UserTypegetType()Gets the user's system type.UserAssociationgetUserAssociation(Platform platform, java.lang.String id)Gets a user association by platform and ID.intgetUserId()java.lang.StringgetUsername()Gets this user's username on the system.inthashCode()booleanhasPermission(Permission permission, Grant fallback)Finds if this entity has a specific permissionUserPromptprompt(java.util.function.Consumer<UserPrompt.Builder> consumer)Constructs and assigns a user prompt for this user.booleanremoveAssociation(Platform platform, java.lang.String platformUserId)Removes a user association from this user.voidsetDisplayName(java.lang.String displayName)Sets this user's desired display name.voidsetLastSeen(int lastSeen)voidsetLastSeenDate(java.util.Date date)Sets the last date this user was seen.booleansetType(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:UserGets this user's desired display name.- Specified by:
getDisplayNamein interfaceUser- Returns:
- Display name.
-
getRegisteredDate
public java.util.Date getRegisteredDate()
Description copied from interface:UserGets the date this user was registered.- Specified by:
getRegisteredDatein interfaceUser- Returns:
- Register date.
-
getLastSeenDate
public java.util.Date getLastSeenDate()
Description copied from interface:UserGets the date this user was last seen.- Specified by:
getLastSeenDatein interfaceUser- Returns:
- Last seen date.
-
setLastSeenDate
public void setLastSeenDate(java.util.Date date)
Description copied from interface:UserSets the last date this user was seen.- Specified by:
setLastSeenDatein interfaceUser- Parameters:
date- last seen date.
-
getMembership
public java.util.Collection<UserGroupMembership> getMembership()
Description copied from interface:UserGets a collection of individual memberships, which is more definite than getUsers(), providing more specific information about membership.- Specified by:
getMembershipin interfaceUser- Returns:
- immutable collection of user group membership records.
-
setDisplayName
public void setDisplayName(java.lang.String displayName) throws java.lang.IllegalArgumentExceptionDescription copied from interface:UserSets this user's desired display name.- Specified by:
setDisplayNamein interfaceUser- Parameters:
displayName- Display name.- Throws:
java.lang.IllegalArgumentException
-
getUsername
public java.lang.String getUsername()
Description copied from interface:UserGets this user's username on the system.- Specified by:
getUsernamein interfaceUser- Returns:
- Username.
-
getUserId
public int getUserId()
-
setLastSeen
public void setLastSeen(int lastSeen)
-
getEntity
public Entity getEntity()
Description copied from interface:EntityTypeGets the entity associated with this object.- Specified by:
getEntityin interfaceEntityType- Returns:
- Associated entity.
-
getUserAssociation
public UserAssociation getUserAssociation(Platform platform, java.lang.String id)
Description copied from interface:UserGets a user association by platform and ID.- Specified by:
getUserAssociationin 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:UserGet a list of connections that associate this user with platforms.- Specified by:
getAssociationsin interfaceUser- Returns:
- user associations.
-
getBans
public java.util.Collection<UserBan> getBans()
Description copied from interface:UserGets a list of all previous bans on record for this user.
-
getIssuedBans
public java.util.Collection<UserBan> getIssuedBans()
Description copied from interface:UserGets a list of all previous bans issued by this user.- Specified by:
getIssuedBansin interfaceUser- Returns:
- immutable collection of user ban issuance history.
-
getBan
public UserBan getBan()
Description copied from interface:UserGets 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:UserBans the user until the specified date
-
ban
public UserBan ban(java.lang.String reason) throws java.lang.SecurityException
Description copied from interface:UserBans the user until the specified date
-
createAssociation
public UserAssociation createAssociation(Platform platform, java.lang.String platformUserId)
Description copied from interface:UserCreates a user connection for this user.- Specified by:
createAssociationin 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:UserRemoves a user association from this user.- Specified by:
removeAssociationin 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:UserGets the user's system type.
-
setType
public boolean setType(UserType userType)
Description copied from interface:UserChanges 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:UserBroadcasts the specified message receiver to the user.- Specified by:
broadcastMessagein 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:UserGets the current user prompt.
-
prompt
public UserPrompt prompt(java.util.function.Consumer<UserPrompt.Builder> consumer) throws java.lang.IllegalStateException
Description copied from interface:UserConstructs 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:EntityTypeFinds if this entity has a specific permission- Specified by:
hasPermissionin interfaceEntityType- Parameters:
permission- Permission to check for.- Returns:
- true if the permission is granted, false otherwise.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-