Refactored every identifier to fit the new naming convention, pom.xml
This commit is contained in:
		| @@ -76,14 +76,14 @@ public class Message { | ||||
| 	 */ | ||||
| 	public Message(envoy.data.Message message) { | ||||
| 		PersistenceManager persMan = PersistenceManager.getInstance(); | ||||
| 		id				= message.getId(); | ||||
| 		id				= message.getID(); | ||||
| 		status			= message.getStatus(); | ||||
| 		text			= message.getText(); | ||||
| 		creationDate	= message.getCreationDate(); | ||||
| 		receivedDate	= message.getReceivedDate(); | ||||
| 		readDate		= message.getReadDate(); | ||||
| 		sender			= persMan.getUserById(message.getSenderId()); | ||||
| 		recipient		= persMan.getUserById(message.getRecipientId()); | ||||
| 		sender			= persMan.getUserById(message.getSenderID()); | ||||
| 		recipient		= persMan.getUserById(message.getRecipientID()); | ||||
| 		forwarded		= message.isForwarded(); | ||||
| 		// TODO: attachment = message.getAttachment().toByteArray();DOES NOT WORK YET | ||||
| 	} | ||||
|   | ||||
| @@ -26,7 +26,7 @@ public class ContactOperationProcessor implements ObjectProcessor<ContactOperati | ||||
| 		switch (evt.getOperationType()) { | ||||
| 			case ADD: | ||||
| 				final long userId = ConnectionManager.getInstance().getUserIdBySocketId(socketId); | ||||
| 				final long contactId = evt.get().getId(); | ||||
| 				final long contactId = evt.get().getID(); | ||||
|  | ||||
| 				System.out.printf("Adding user %s to the contact list of user %d.%n", evt.get(), userId); | ||||
| 				PersistenceManager.getInstance().addUserContact(userId, contactId); | ||||
|   | ||||
| @@ -30,7 +30,7 @@ public class MessageProcessor implements ObjectProcessor<Message> { | ||||
|  | ||||
| 		message.nextStatus(); | ||||
| 		ConnectionManager	connectionManager	= ConnectionManager.getInstance(); | ||||
| 		Contact				recipient			= PersistenceManager.getInstance().getContactById(message.getId()); | ||||
| 		Contact				recipient			= PersistenceManager.getInstance().getContactById(message.getID()); | ||||
|  | ||||
| 		if (recipient instanceof envoy.server.data.User) { | ||||
| 			System.out.println("The received message is a direct message."); | ||||
| @@ -39,15 +39,15 @@ public class MessageProcessor implements ObjectProcessor<Message> { | ||||
| 			try { | ||||
| 				writeProxy.write(socketId, new MessageStatusChangeEvent(message)); | ||||
| 			} catch (IOException e) { | ||||
| 				System.err.println("Could not send messageStatusChangeEvent to the sender of this message with ID: " + message.getId()); | ||||
| 				System.err.println("Could not send messageStatusChangeEvent to the sender of this message with ID: " + message.getID()); | ||||
| 				e.printStackTrace(); | ||||
| 			} | ||||
| 		} else { | ||||
| 			System.out.println("The received message is a group message."); | ||||
| 			final var	members		= PersistenceManager.getInstance().getGroupById(message.getRecipientId()).getMembers(); | ||||
| 			final var	members		= PersistenceManager.getInstance().getGroupById(message.getRecipientID()).getMembers(); | ||||
| 			final var	generator	= IDGeneratorRequestProcessor.createIDGenerator(members.size()); | ||||
| 			members.forEach(user -> { | ||||
| 				envoy.data.Message returnMessage = new MessageBuilder(message.getRecipientId(), user.getID(), generator) | ||||
| 				envoy.data.Message returnMessage = new MessageBuilder(message.getRecipientID(), user.getID(), generator) | ||||
| 					.setDate(message.getCreationDate()) | ||||
| 					.setText(message.getText()) | ||||
| 					.setAttachment(message.getAttachment()) | ||||
| @@ -64,15 +64,15 @@ public class MessageProcessor implements ObjectProcessor<Message> { | ||||
| 	} | ||||
|  | ||||
| 	private void sendToUser(ConnectionManager connectionManager, Message message, ObjectWriteProxy writeProxy) { | ||||
| 		if (connectionManager.isOnline(message.getRecipientId())) try { | ||||
| 		if (connectionManager.isOnline(message.getRecipientID())) try { | ||||
| 			// If recipient is online, send the message directly | ||||
| 			writeProxy.write(connectionManager.getSocketId(message.getRecipientId()), message); | ||||
| 			writeProxy.write(connectionManager.getSocketId(message.getRecipientID()), message); | ||||
| 			// Update the message status to RECEIVED | ||||
| 			message.setReceivedDate(new Date()); | ||||
| 			message.nextStatus(); | ||||
|  | ||||
| 		} catch (IOException e) { | ||||
| 			System.err.println("Recipient online. Failed to send message" + message.getId()); | ||||
| 			System.err.println("Recipient online. Failed to send message" + message.getID()); | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
| 	} | ||||
|   | ||||
| @@ -27,7 +27,7 @@ public class MessageStatusChangeProcessor implements ObjectProcessor<MessageStat | ||||
| 		// 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")); | ||||
|  | ||||
| 		envoy.server.data.Message msg = persistenceManager.getMessageById(input.getId()); | ||||
| 		envoy.server.data.Message msg = persistenceManager.getMessageById(input.getID()); | ||||
| 		msg.setStatus(input.get()); | ||||
| 		msg.setReadDate(input.getDate()); | ||||
| 		persistenceManager.updateMessage(msg); | ||||
|   | ||||
| @@ -30,7 +30,7 @@ public class UserStatusChangeProcessor implements ObjectProcessor<UserStatusChan | ||||
| 	@Override | ||||
| 	public void process(UserStatusChangeEvent input, long socketId, ObjectWriteProxy writeProxy) throws IOException { | ||||
| 		// new status should not equal old status | ||||
| 		if (input.get().equals(persistenceManager.getUserById(input.getId()).getStatus())) { | ||||
| 		if (input.get().equals(persistenceManager.getUserById(input.getID()).getStatus())) { | ||||
| 			System.out.println("Received an unnecessary UserStatusChangeEvent"); | ||||
| 			return; | ||||
| 		} | ||||
| @@ -58,7 +58,7 @@ public class UserStatusChangeProcessor implements ObjectProcessor<UserStatusChan | ||||
| 	 * @param evt the {@link UserStatusChangeEvent} | ||||
| 	 * @since Envoy Server Standalone v0.1-alpha | ||||
| 	 */ | ||||
| 	public static void updateUserStatus(UserStatusChangeEvent evt) { updateUserStatus(persistenceManager.getUserById(evt.getId())); } | ||||
| 	public static void updateUserStatus(UserStatusChangeEvent evt) { updateUserStatus(persistenceManager.getUserById(evt.getID())); } | ||||
|  | ||||
| 	/** | ||||
| 	 * notifies active contacts of this {@link User} that his {@link UserStatus} has | ||||
| @@ -75,7 +75,7 @@ public class UserStatusChangeProcessor implements ObjectProcessor<UserStatusChan | ||||
| 				if (connectionManager.isOnline(contact.getID())) writeProxy.write(connectionManager.getSocketId(contact.getID()), evt); | ||||
| 		} catch (IOException e) { | ||||
| 			e.printStackTrace(); | ||||
| 			System.err.println("Could not notify online contacts of user " + evt.getId() + " that his status has been changed"); | ||||
| 			System.err.println("Could not notify online contacts of user " + evt.getID() + " that his status has been changed"); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 DieGurke
					DieGurke