Merge branch 'develop' into f/new_ui
Conflicts: client/src/main/java/envoy/client/ui/controller/LoginScene.java
This commit is contained in:
		@@ -17,9 +17,10 @@ import java.util.Set;
 | 
			
		||||
 */
 | 
			
		||||
public abstract class Contact implements Serializable {
 | 
			
		||||
 | 
			
		||||
	private final long								id;
 | 
			
		||||
	private final transient Set<? extends Contact>	contacts;
 | 
			
		||||
	private String									name;
 | 
			
		||||
	protected final long								id;
 | 
			
		||||
	protected final transient Set<? extends Contact>	contacts;
 | 
			
		||||
 | 
			
		||||
	protected String name;
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = 0L;
 | 
			
		||||
 | 
			
		||||
@@ -55,19 +56,13 @@ public abstract class Contact implements Serializable {
 | 
			
		||||
	 */
 | 
			
		||||
	public void setName(String name) { this.name = name; }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * {@inheritDoc}
 | 
			
		||||
	 */
 | 
			
		||||
	@Override
 | 
			
		||||
	public String toString() { return String.format("Contact[id=%d,name=%s, contacts=%s]", id, name, contacts); }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Provides a hash code based on the ID of this contact.
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @since Envoy Common v0.1-beta
 | 
			
		||||
	 */
 | 
			
		||||
	@Override
 | 
			
		||||
	public int hashCode() { return Objects.hash(id); }
 | 
			
		||||
	public final int hashCode() { return Objects.hash(id); }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Tests equality to another object. If that object is a contact as well,
 | 
			
		||||
@@ -77,7 +72,7 @@ public abstract class Contact implements Serializable {
 | 
			
		||||
	 * @return {code true} if both objects are contacts and have identical IDs
 | 
			
		||||
	 */
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean equals(Object obj) {
 | 
			
		||||
	public final boolean equals(Object obj) {
 | 
			
		||||
		if (this == obj) return true;
 | 
			
		||||
		if (!(obj instanceof Contact)) return false;
 | 
			
		||||
		return id == ((Contact) obj).id;
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,9 @@ public final class Group extends Contact {
 | 
			
		||||
	 */
 | 
			
		||||
	public Group(long id, String name, Set<User> members) { super(id, name, members); }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String toString() { return String.format("Group[id=%d,name=%s,%d member(s)]", id, name, contacts.size()); }
 | 
			
		||||
 | 
			
		||||
	private void readObject(ObjectInputStream inputStream) throws Exception {
 | 
			
		||||
		inputStream.defaultReadObject();
 | 
			
		||||
		var contacts = Contact.class.getDeclaredField("contacts");
 | 
			
		||||
@@ -49,7 +52,6 @@ public final class Group extends Contact {
 | 
			
		||||
		outputStream.writeObject(getContacts());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings("unchecked")
 | 
			
		||||
	@Override
 | 
			
		||||
	public Set<User> getContacts() { return (Set<User>) super.getContacts(); }
 | 
			
		||||
	public Set<User> getContacts() { return (Set<User>) contacts; }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
package envoy.data;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@@ -16,7 +16,7 @@ public final class GroupMessage extends Message {
 | 
			
		||||
 | 
			
		||||
	private final Map<Long, MessageStatus> memberStatuses;
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = 0L;
 | 
			
		||||
	private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Initializes a {@link GroupMessage} with values for all of its properties. The
 | 
			
		||||
@@ -38,9 +38,9 @@ public final class GroupMessage extends Message {
 | 
			
		||||
	 * @param forwarded      whether this message was forwarded
 | 
			
		||||
	 * @param memberStatuses a map of all members and their status according to this
 | 
			
		||||
	 *                       {@link GroupMessage}
 | 
			
		||||
	 * @since Envoy Common v0.1-beta
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	GroupMessage(long id, long senderID, long groupID, LocalDateTime creationDate, LocalDateTime receivedDate, LocalDateTime readDate, String text,
 | 
			
		||||
	GroupMessage(long id, long senderID, long groupID, Instant creationDate, Instant receivedDate, Instant readDate, String text,
 | 
			
		||||
			Attachment attachment, MessageStatus status, boolean forwarded, Map<Long, MessageStatus> memberStatuses) {
 | 
			
		||||
		super(id, senderID, groupID, creationDate, receivedDate, readDate, text, attachment, status, forwarded);
 | 
			
		||||
		this.memberStatuses = memberStatuses;
 | 
			
		||||
@@ -55,10 +55,10 @@ public final class GroupMessage extends Message {
 | 
			
		||||
		setStatus(Collections.min(memberStatuses.values()));
 | 
			
		||||
		switch (getStatus()) {
 | 
			
		||||
			case RECEIVED:
 | 
			
		||||
				setReceivedDate(LocalDateTime.now());
 | 
			
		||||
				setReceivedDate(Instant.now());
 | 
			
		||||
				break;
 | 
			
		||||
			case READ:
 | 
			
		||||
				setReadDate(LocalDateTime.now());
 | 
			
		||||
				setReadDate(Instant.now());
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
package envoy.data;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Contains a {@link User}'s login / registration information as well as the
 | 
			
		||||
@@ -17,8 +18,9 @@ public final class LoginCredentials implements Serializable {
 | 
			
		||||
 | 
			
		||||
	private final String	identifier, password, clientVersion;
 | 
			
		||||
	private final boolean	registration;
 | 
			
		||||
	private final Instant	lastSync;
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = 2;
 | 
			
		||||
	private static final long serialVersionUID = 3;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Initializes login credentials for a handshake.
 | 
			
		||||
@@ -28,18 +30,24 @@ public final class LoginCredentials implements Serializable {
 | 
			
		||||
	 * @param registration  signifies that these credentials are used for user
 | 
			
		||||
	 *                      registration instead of user login
 | 
			
		||||
	 * @param clientVersion the version of the client sending these credentials
 | 
			
		||||
	 * @since Envoy Common v0.1-beta
 | 
			
		||||
	 * @param lastSync      the time stamp of the last synchronization
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public LoginCredentials(String identifier, String password, boolean registration, String clientVersion) {
 | 
			
		||||
	public LoginCredentials(String identifier, String password, boolean registration, String clientVersion, Instant lastSync) {
 | 
			
		||||
		this.identifier		= identifier;
 | 
			
		||||
		this.password		= password;
 | 
			
		||||
		this.registration	= registration;
 | 
			
		||||
		this.clientVersion	= clientVersion;
 | 
			
		||||
		this.lastSync		= lastSync;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String toString() {
 | 
			
		||||
		return String.format("LoginCredentials[identifier=%s,registration=%b,clientVersion=%s]", identifier, registration, clientVersion);
 | 
			
		||||
		return String.format("LoginCredentials[identifier=%s,registration=%b,clientVersion=%s,lastSync=%s]",
 | 
			
		||||
				identifier,
 | 
			
		||||
				registration,
 | 
			
		||||
				clientVersion,
 | 
			
		||||
				lastSync);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
@@ -66,4 +74,10 @@ public final class LoginCredentials implements Serializable {
 | 
			
		||||
	 * @since Envoy Common v0.1-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public String getClientVersion() { return clientVersion; }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the time stamp of the last synchronization
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public Instant getLastSync() { return lastSync; }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,7 @@
 | 
			
		||||
package envoy.data;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.format.DateTimeFormatter;
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Represents a unique message with a unique, numeric ID. Further metadata
 | 
			
		||||
@@ -50,14 +49,14 @@ public class Message implements Serializable {
 | 
			
		||||
 | 
			
		||||
	private final long			id, senderID, recipientID;
 | 
			
		||||
	private final boolean		forwarded;
 | 
			
		||||
	private final LocalDateTime	creationDate;
 | 
			
		||||
	private final Instant		creationDate;
 | 
			
		||||
	private final String		text;
 | 
			
		||||
	private final Attachment	attachment;
 | 
			
		||||
 | 
			
		||||
	private LocalDateTime	receivedDate, readDate;
 | 
			
		||||
	private Instant			receivedDate, readDate;
 | 
			
		||||
	private MessageStatus	status;
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = 1L;
 | 
			
		||||
	private static final long serialVersionUID = 2L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Initializes a {@link Message} with values for all of its properties. The use
 | 
			
		||||
@@ -75,9 +74,9 @@ public class Message implements Serializable {
 | 
			
		||||
	 * @param attachment   the attachment of the message, if present
 | 
			
		||||
	 * @param status       the current {@link MessageStatus} of the message
 | 
			
		||||
	 * @param forwarded    whether this message was forwarded
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	Message(long id, long senderID, long recipientID, LocalDateTime creationDate, LocalDateTime receivedDate, LocalDateTime readDate, String text,
 | 
			
		||||
	Message(long id, long senderID, long recipientID, Instant creationDate, Instant receivedDate, Instant readDate, String text,
 | 
			
		||||
			Attachment attachment, MessageStatus status, boolean forwarded) {
 | 
			
		||||
		this.id				= id;
 | 
			
		||||
		this.senderID		= senderID;
 | 
			
		||||
@@ -115,7 +114,7 @@ public class Message implements Serializable {
 | 
			
		||||
				id,
 | 
			
		||||
				senderID,
 | 
			
		||||
				recipientID,
 | 
			
		||||
				DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss").format(creationDate),
 | 
			
		||||
				creationDate,
 | 
			
		||||
				status,
 | 
			
		||||
				text,
 | 
			
		||||
				forwarded,
 | 
			
		||||
@@ -142,34 +141,34 @@ public class Message implements Serializable {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the date at which this message was created
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public LocalDateTime getCreationDate() { return creationDate; }
 | 
			
		||||
	public Instant getCreationDate() { return creationDate; }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the date at which the message has been received by the sender
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public LocalDateTime getReceivedDate() { return receivedDate; }
 | 
			
		||||
	public Instant getReceivedDate() { return receivedDate; }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param receivedDate the date at which the message has been received by the
 | 
			
		||||
	 *                     sender
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public void setReceivedDate(LocalDateTime receivedDate) { this.receivedDate = receivedDate; }
 | 
			
		||||
	public void setReceivedDate(Instant receivedDate) { this.receivedDate = receivedDate; }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the date at which the message has been read by the sender
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public LocalDateTime getReadDate() { return readDate; }
 | 
			
		||||
	public Instant getReadDate() { return readDate; }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param readDate at which the message has been read by the sender
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public void setReadDate(LocalDateTime readDate) { this.readDate = readDate; }
 | 
			
		||||
	public void setReadDate(Instant readDate) { this.readDate = readDate; }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the text content of this message
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
package envoy.data;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@@ -23,7 +23,7 @@ public class MessageBuilder {
 | 
			
		||||
 | 
			
		||||
	// Properties with default values
 | 
			
		||||
	private long					id;
 | 
			
		||||
	private LocalDateTime			creationDate, receivedDate, readDate;
 | 
			
		||||
	private Instant					creationDate, receivedDate, readDate;
 | 
			
		||||
	private String					text;
 | 
			
		||||
	private Attachment				attachment;
 | 
			
		||||
	private Message.MessageStatus	status;
 | 
			
		||||
@@ -70,7 +70,7 @@ public class MessageBuilder {
 | 
			
		||||
	public MessageBuilder(Message msg, long recipientID, IDGenerator iDGenerator) {
 | 
			
		||||
		this(msg.getRecipientID(), recipientID, iDGenerator.next());
 | 
			
		||||
		this.attachment		= msg.getAttachment();
 | 
			
		||||
		this.creationDate	= LocalDateTime.now();
 | 
			
		||||
		this.creationDate	= Instant.now();
 | 
			
		||||
		this.forwarded		= true;
 | 
			
		||||
		this.text			= msg.getText();
 | 
			
		||||
		this.status			= MessageStatus.WAITING;
 | 
			
		||||
@@ -83,7 +83,7 @@ public class MessageBuilder {
 | 
			
		||||
	 * <table border="1">
 | 
			
		||||
	 * <tr>
 | 
			
		||||
	 * <td>{@code date}</td>
 | 
			
		||||
	 * <td>{@code LocalDateTime.now()} and {@code null} for {@code receivedDate} and
 | 
			
		||||
	 * <td>{@code Instant.now()} and {@code null} for {@code receivedDate} and
 | 
			
		||||
	 * {@code readDate}</td>
 | 
			
		||||
	 * <tr>
 | 
			
		||||
	 * <tr>
 | 
			
		||||
@@ -113,8 +113,8 @@ public class MessageBuilder {
 | 
			
		||||
	 * <br>
 | 
			
		||||
	 * <table border="1">
 | 
			
		||||
	 * <tr>
 | 
			
		||||
	 * <td>{@code date}</td>
 | 
			
		||||
	 * <td>{@code new Date()}</td>
 | 
			
		||||
	 * <td>{@code time stamp}</td>
 | 
			
		||||
	 * <td>{@code Instant.now()}</td>
 | 
			
		||||
	 * <tr>
 | 
			
		||||
	 * <tr>
 | 
			
		||||
	 * <td>{@code text}</td>
 | 
			
		||||
@@ -140,8 +140,8 @@ public class MessageBuilder {
 | 
			
		||||
	 * <br>
 | 
			
		||||
	 * <table border="1">
 | 
			
		||||
	 * <tr>
 | 
			
		||||
	 * <td>{@code date}</td>
 | 
			
		||||
	 * <td>{@code new Date()}</td>
 | 
			
		||||
	 * <td>{@code time stamp}</td>
 | 
			
		||||
	 * <td>{@code Instant.now()}</td>
 | 
			
		||||
	 * <tr>
 | 
			
		||||
	 * <tr>
 | 
			
		||||
	 * <td>{@code text}</td>
 | 
			
		||||
@@ -162,7 +162,7 @@ public class MessageBuilder {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private void supplyDefaults() {
 | 
			
		||||
		if (creationDate == null) creationDate = LocalDateTime.now();
 | 
			
		||||
		if (creationDate == null) creationDate = Instant.now();
 | 
			
		||||
		if (text == null) text = "";
 | 
			
		||||
		if (status == null) status = MessageStatus.WAITING;
 | 
			
		||||
	}
 | 
			
		||||
@@ -170,9 +170,9 @@ public class MessageBuilder {
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param creationDate the creation date of the {@link Message} to create
 | 
			
		||||
	 * @return this {@link MessageBuilder}
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public MessageBuilder setCreationDate(LocalDateTime creationDate) {
 | 
			
		||||
	public MessageBuilder setCreationDate(Instant creationDate) {
 | 
			
		||||
		this.creationDate = creationDate;
 | 
			
		||||
		return this;
 | 
			
		||||
	}
 | 
			
		||||
@@ -180,9 +180,9 @@ public class MessageBuilder {
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param receivedDate the received date of the {@link Message} to create
 | 
			
		||||
	 * @return this {@link MessageBuilder}
 | 
			
		||||
	 * @since Envoy Common v0.1-beta
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public MessageBuilder setReceivedDate(LocalDateTime receivedDate) {
 | 
			
		||||
	public MessageBuilder setReceivedDate(Instant receivedDate) {
 | 
			
		||||
		this.receivedDate = receivedDate;
 | 
			
		||||
		return this;
 | 
			
		||||
	}
 | 
			
		||||
@@ -190,9 +190,9 @@ public class MessageBuilder {
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param readDate the read date of the {@link Message} to create
 | 
			
		||||
	 * @return this {@link MessageBuilder}
 | 
			
		||||
	 * @since Envoy Common v0.1-beta
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public MessageBuilder setReadDate(LocalDateTime readDate) {
 | 
			
		||||
	public MessageBuilder setReadDate(Instant readDate) {
 | 
			
		||||
		this.readDate = readDate;
 | 
			
		||||
		return this;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -99,7 +99,9 @@ public final class User extends Contact {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String toString() { return String.format("User[id=%d,name=%s,status=%s,contacts=%s]", getID(), getName(), status, getContacts()); }
 | 
			
		||||
	public String toString() {
 | 
			
		||||
		return String.format("User[id=%d,name=%s,status=%s", id, name, status) + (contacts.isEmpty() ? "]" : "," + contacts.size() + " contact(s)]");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the current status of this user
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,6 @@ public class EventBus {
 | 
			
		||||
	 * @param handler    the event handler to register
 | 
			
		||||
	 * @since Envoy v0.2-alpha
 | 
			
		||||
	 */
 | 
			
		||||
	@SuppressWarnings("unchecked")
 | 
			
		||||
	public <T extends Event<?>> void register(Class<T> eventClass, Consumer<T> handler) {
 | 
			
		||||
		if (!handlers.containsKey(eventClass)) handlers.put(eventClass, new ArrayList<>());
 | 
			
		||||
		handlers.get(eventClass).add((Consumer<Event<?>>) handler);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
package envoy.event;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
 | 
			
		||||
import envoy.data.GroupMessage;
 | 
			
		||||
import envoy.data.Message.MessageStatus;
 | 
			
		||||
@@ -27,9 +27,9 @@ public class GroupMessageStatusChange extends MessageStatusChange {
 | 
			
		||||
	 * @param date     the date at which the MessageStatus change occurred for
 | 
			
		||||
	 *                 this specific member
 | 
			
		||||
	 * @param memberID the ID of the group member that caused the status change
 | 
			
		||||
	 * @since Envoy Common v0.1-beta
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public GroupMessageStatusChange(long id, MessageStatus status, LocalDateTime date, long memberID) {
 | 
			
		||||
	public GroupMessageStatusChange(long id, MessageStatus status, Instant date, long memberID) {
 | 
			
		||||
		super(id, status, date);
 | 
			
		||||
		this.memberID = memberID;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
package envoy.event;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
 | 
			
		||||
import envoy.data.Message;
 | 
			
		||||
 | 
			
		||||
@@ -14,8 +14,8 @@ import envoy.data.Message;
 | 
			
		||||
 */
 | 
			
		||||
public class MessageStatusChange extends Event<Message.MessageStatus> {
 | 
			
		||||
 | 
			
		||||
	private final long	id;
 | 
			
		||||
	private final LocalDateTime	date;
 | 
			
		||||
	private final long		id;
 | 
			
		||||
	private final Instant	date;
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = 0L;
 | 
			
		||||
 | 
			
		||||
@@ -26,9 +26,9 @@ public class MessageStatusChange extends Event<Message.MessageStatus> {
 | 
			
		||||
	 * @param status the status of the {@link Message} this event is related
 | 
			
		||||
	 *               to
 | 
			
		||||
	 * @param date   the date at which the MessageStatus change occurred
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public MessageStatusChange(long id, Message.MessageStatus status, LocalDateTime date) {
 | 
			
		||||
	public MessageStatusChange(long id, Message.MessageStatus status, Instant date) {
 | 
			
		||||
		super(status);
 | 
			
		||||
		this.id		= id;
 | 
			
		||||
		this.date	= date;
 | 
			
		||||
@@ -40,7 +40,7 @@ public class MessageStatusChange extends Event<Message.MessageStatus> {
 | 
			
		||||
	 * @param message the message from which to build the event
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 */
 | 
			
		||||
	public MessageStatusChange(Message message) { this(message.getID(), message.getStatus(), LocalDateTime.now()); }
 | 
			
		||||
	public MessageStatusChange(Message message) { this(message.getID(), message.getStatus(), Instant.now()); }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the ID of the {@link Message} this event is related to
 | 
			
		||||
@@ -50,9 +50,9 @@ public class MessageStatusChange extends Event<Message.MessageStatus> {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the date at which the status change occurred
 | 
			
		||||
	 * @since Envoy Common v0.2-alpha
 | 
			
		||||
	 * @since Envoy Common v0.2-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public LocalDateTime getDate() { return date; }
 | 
			
		||||
	public Instant getDate() { return date; }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String toString() { return String.format("MessageStatusChange[id=%d,status=%s,date=%s]", id, value, date); }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user