Merge pull request #8 from informatik-ag-ngl/f/user_status_change_event
Added UserStatusChangeEvent
This commit is contained in:
		| @@ -61,4 +61,7 @@ public class MessageStatusChangeEvent implements Event<Message.MessageStatus> { | ||||
| 	 * @since Envoy Common v0.2-alpha | ||||
| 	 */ | ||||
| 	public Date getDate() { return date; } | ||||
|  | ||||
| 	@Override | ||||
| 	public String toString() { return String.format("MessageStatusChangeEvent[id=%d,status=%s,date=%s]", id, status, date); } | ||||
| } | ||||
|   | ||||
							
								
								
									
										57
									
								
								src/main/java/envoy/event/UserStatusChangeEvent.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								src/main/java/envoy/event/UserStatusChangeEvent.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | ||||
| package envoy.event; | ||||
|  | ||||
| import envoy.data.User; | ||||
| import envoy.data.User.UserStatus; | ||||
|  | ||||
| /** | ||||
|  * Project: <strong>envoy-common</strong><br> | ||||
|  * File: <strong>UserStatusChangeEvent.java</strong><br> | ||||
|  * Created: <strong>1 Feb 2020</strong><br> | ||||
|  * | ||||
|  * @author Leon Hofmeister | ||||
|  * @since Envoy Common v0.2-alpha | ||||
|  */ | ||||
| public class UserStatusChangeEvent implements Event<UserStatus> { | ||||
|  | ||||
| 	private final long				id; | ||||
| 	private final User.UserStatus	status; | ||||
|  | ||||
| 	private static final long serialVersionUID = 4566145392192761313L; | ||||
|  | ||||
| 	/** | ||||
| 	 * Initializes a {@link UserStatusChangeEvent}. | ||||
| 	 * | ||||
| 	 * @param id     the ID of the {@link User} this event is related to | ||||
| 	 * @param status the status of the {@link User} this event is related | ||||
| 	 *               to | ||||
| 	 * @since Envoy Common v0.2-alpha | ||||
| 	 */ | ||||
| 	public UserStatusChangeEvent(long id, User.UserStatus status) { | ||||
| 		this.id		= id; | ||||
| 		this.status	= status; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * Initializes a {@link UserStatusChangeEvent} through a User. | ||||
| 	 * | ||||
| 	 * @param user the User from which to build the event | ||||
| 	 * @since Envoy Common v0.2-alpha | ||||
| 	 */ | ||||
| 	public UserStatusChangeEvent(User user) { this(user.getId(), user.getStatus()); } | ||||
|  | ||||
| 	/** | ||||
| 	 * @return the status of the {@link User} this event is related to | ||||
| 	 * @since Envoy Common v0.2-alpha | ||||
| 	 */ | ||||
| 	@Override | ||||
| 	public User.UserStatus get() { return status; } | ||||
|  | ||||
| 	/** | ||||
| 	 * @return the ID of the {@link User} this event is related to | ||||
| 	 * @since Envoy Common v0.2-alpha | ||||
| 	 */ | ||||
| 	public long getId() { return id; } | ||||
|  | ||||
| 	@Override | ||||
| 	public String toString() { return String.format("UserStatusChangeEvent[id=%d,status=%s]", id, status); } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 delvh
					delvh