Small cleanup
This commit is contained in:
		@@ -32,10 +32,10 @@ public class Message {
 | 
				
			|||||||
	@Id
 | 
						@Id
 | 
				
			||||||
	private long id;
 | 
						private long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@ManyToOne(cascade = { CascadeType.PERSIST })
 | 
						@ManyToOne(cascade = CascadeType.PERSIST)
 | 
				
			||||||
	private User sender;
 | 
						private User sender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@ManyToOne(cascade = { CascadeType.PERSIST })
 | 
						@ManyToOne(cascade = CascadeType.PERSIST)
 | 
				
			||||||
	private User recipient;
 | 
						private User recipient;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Temporal(TemporalType.TIMESTAMP)
 | 
						@Temporal(TemporalType.TIMESTAMP)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,7 +69,7 @@ public class User {
 | 
				
			|||||||
	 * @return a database {@link User} converted into an {@link envoy.data.User}
 | 
						 * @return a database {@link User} converted into an {@link envoy.data.User}
 | 
				
			||||||
	 * @since Envoy Server Standalone v0.1-alpha
 | 
						 * @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}
 | 
						 * @return the id of a {link envoy.data.User}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -85,7 +85,7 @@ public class ConnectionManager implements ISocketIdListener {
 | 
				
			|||||||
	 * @since Envoy Server Standalone v0.1-alpha
 | 
						 * @since Envoy Server Standalone v0.1-alpha
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public long getUserIdBySocketId(long socketId) {
 | 
						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();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,12 +24,8 @@ public class MessageStatusChangeProcessor implements ObjectProcessor<MessageStat
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void process(MessageStatusChangeEvent input, long socketId, ObjectWriteProxy writeProxy) throws IOException {
 | 
						public void process(MessageStatusChangeEvent input, long socketId, ObjectWriteProxy writeProxy) throws IOException {
 | 
				
			||||||
		try {
 | 
							// Any other status than READ is not supposed to be sent to the server
 | 
				
			||||||
			// any other status than read is not supposed to be sent to the server
 | 
							if (input.get() != MessageStatus.READ) throw new IOException(new EnvoyException("Message " + input + " has an invalid status"));
 | 
				
			||||||
			if (input.get() != MessageStatus.READ) throw new EnvoyException("Message " + input + " has an invalid status");
 | 
					 | 
				
			||||||
		} catch (EnvoyException e) {
 | 
					 | 
				
			||||||
			throw new IOException(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		envoy.server.data.Message msg = persistenceManager.getMessageById(input.getId());
 | 
							envoy.server.data.Message msg = persistenceManager.getMessageById(input.getId());
 | 
				
			||||||
		msg.setStatus(input.get());
 | 
							msg.setStatus(input.get());
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,9 +64,7 @@ public class UserStatusChangeProcessor implements ObjectProcessor<UserStatusChan
 | 
				
			|||||||
	 * notifies active contacts of this {@link User} that his {@link UserStatus} has
 | 
						 * notifies active contacts of this {@link User} that his {@link UserStatus} has
 | 
				
			||||||
	 * changed
 | 
						 * changed
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
	 * @param evt  the {@link UserStatusChangeEvent} to send to other clients
 | 
					 | 
				
			||||||
	 * @param user the {@link User}
 | 
						 * @param user the {@link User}
 | 
				
			||||||
	 * @throws IOException if sending this update failed for any contact
 | 
					 | 
				
			||||||
	 * @since Envoy Server Standalone v0.1-alpha
 | 
						 * @since Envoy Server Standalone v0.1-alpha
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private static void notifyContacts(User user) {
 | 
						private static void notifyContacts(User user) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user