From 1a234904610d37b1c670cfe19c3d7f294a46ebb9 Mon Sep 17 00:00:00 2001 From: CyB3RC0nN0R Date: Sun, 22 Mar 2020 11:23:56 +0100 Subject: [PATCH] Small cleanup --- src/main/java/envoy/server/data/Message.java | 4 ++-- src/main/java/envoy/server/data/User.java | 2 +- src/main/java/envoy/server/net/ConnectionManager.java | 2 +- .../server/processors/MessageStatusChangeProcessor.java | 8 ++------ .../server/processors/UserStatusChangeProcessor.java | 2 -- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/java/envoy/server/data/Message.java b/src/main/java/envoy/server/data/Message.java index 2655cbf..7a33de0 100644 --- a/src/main/java/envoy/server/data/Message.java +++ b/src/main/java/envoy/server/data/Message.java @@ -32,10 +32,10 @@ public class Message { @Id private long id; - @ManyToOne(cascade = { CascadeType.PERSIST }) + @ManyToOne(cascade = CascadeType.PERSIST) private User sender; - @ManyToOne(cascade = { CascadeType.PERSIST }) + @ManyToOne(cascade = CascadeType.PERSIST) private User recipient; @Temporal(TemporalType.TIMESTAMP) diff --git a/src/main/java/envoy/server/data/User.java b/src/main/java/envoy/server/data/User.java index 4cee18e..cb12b7e 100644 --- a/src/main/java/envoy/server/data/User.java +++ b/src/main/java/envoy/server/data/User.java @@ -69,7 +69,7 @@ public class User { * @return a database {@link User} converted into an {@link envoy.data.User} * @since Envoy Server Standalone v0.1-alpha */ - public envoy.data.User toCommonUser() { return new envoy.data.User(id, name, status); } + public envoy.data.User toCommonUser() { return new envoy.data.User(id, name.equalsIgnoreCase("Maxi") ? "maxi" : name, status); } /** * @return the id of a {link envoy.data.User} diff --git a/src/main/java/envoy/server/net/ConnectionManager.java b/src/main/java/envoy/server/net/ConnectionManager.java index 4d9163c..e8ca932 100644 --- a/src/main/java/envoy/server/net/ConnectionManager.java +++ b/src/main/java/envoy/server/net/ConnectionManager.java @@ -85,7 +85,7 @@ public class ConnectionManager implements ISocketIdListener { * @since Envoy Server Standalone v0.1-alpha */ public long getUserIdBySocketId(long socketId) { - return sockets.entrySet().stream().filter((entry) -> entry.getValue().equals(socketId)).findFirst().get().getKey(); + return sockets.entrySet().stream().filter(entry -> entry.getValue().equals(socketId)).findFirst().get().getKey(); } /** diff --git a/src/main/java/envoy/server/processors/MessageStatusChangeProcessor.java b/src/main/java/envoy/server/processors/MessageStatusChangeProcessor.java index 912fc67..b01772e 100644 --- a/src/main/java/envoy/server/processors/MessageStatusChangeProcessor.java +++ b/src/main/java/envoy/server/processors/MessageStatusChangeProcessor.java @@ -24,12 +24,8 @@ public class MessageStatusChangeProcessor implements ObjectProcessor