This repository has been archived on 2021-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
envoy/src/main/java/envoy/data/User.java

90 lines
1.9 KiB
Java
Raw Normal View History

package envoy.data;
/**
* Represents a unique user with a unique, numeric ID, a name and a current
* {@link UserStatus}.<br>
* <br>
* Project: <strong>envoy-common</strong><br>
* File: <strong>User.java</strong><br>
* Created: <strong>28.12.2019</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha
*/
public class User extends Contact {
/**
2019-12-31 10:16:52 +01:00
* This enumeration defines all possible statuses a user can have.
*
* @since Envoy Common v0.2-alpha
*/
public static enum UserStatus {
/**
* select this, if a user is online and can be interacted with
*/
ONLINE,
/**
* select this, if a user is online but unavailable at the moment (sudden
* interruption)
*/
AWAY,
/**
* select this, if a user is online but unavailable at the moment (polite way)
*/
BUSY,
/**
* select this, if a user is offline
*/
OFFLINE;
}
2020-01-02 17:50:04 +01:00
private UserStatus status;
private static final long serialVersionUID = 1L;
2019-12-31 10:16:52 +01:00
/**
* Initializes a {@link User}. <br>
* The {@link UserStatus} is set to {@link UserStatus#ONLINE}.
*
* @param id unique ID
* @param name user name
* @since Envoy Common v0.2-alpha
*/
public User(long id, String name) {
super(id, name);
status = UserStatus.ONLINE;
}
/**
* Initializes a {@link User}.
*
* @param id unique ID
* @param name user name
* @param status the status of the user
* @since Envoy Common v0.2-alpha
*/
public User(long id, String name, UserStatus status) {
super(id, name);
this.status = status;
}
2019-12-31 10:20:35 +01:00
@Override
public String toString() { return String.format("User[id=%d,name=%s,status=%s]", getID(), getName(), status); }
/**
* @return the current status of this user
* @since Envoy Common v0.2-alpha
*/
public UserStatus getStatus() { return status; }
/**
2020-01-02 17:50:04 +01:00
* @param status the next status of this user
* @since Envoy Common v0.2-alpha
*/
public void setStatus(UserStatus status) { this.status = status; }
}