Copying received and read dates in Message#toCommonMessage()

This commit is contained in:
Kai S. K. Engelbart 2020-02-16 10:31:17 +01:00
parent 1279a8cd4e
commit ea6d76757e

View File

@ -79,13 +79,21 @@ public class Message {
}
/**
* @return a database {@link Message} converted into an
* {@link envoy.data.Message}
* Converts this message into an instance of {@link envoy.data.Message}.
*
* @return a {@link envoy.data.Message} containing the same values as this
* message
* @since Envoy Server Standalone v0.1-alpha
*/
public envoy.data.Message toCommonMessage() {
// TODO: Attachment, dates
return new MessageBuilder(sender.getId(), recipient.getId(), id).setText(text).setDate(creationDate).setStatus(status).build();
// TODO: Attachment
envoy.data.Message message = new MessageBuilder(sender.getId(), recipient.getId(), id).setText(text)
.setDate(creationDate)
.setStatus(status)
.build();
message.setReceivedDate(receivedDate);
message.setReadDate(readDate);
return message;
}
/**