/**
* Map a {@link SceneSDO} to a {@link MessageDTO}.
*/
public static MessageDTO mapMessage(Message message) {
final MessageDTO dto = new MessageDTO();
dto.setId(message.getKey().getId());
dto.setType(MessageType.getMessageType(message.getType()));
dto.setAction(MessageAction.getMessageAction(message.getAction()));
dto.setIndex(message.getIndex() == null ? 0 : message.getIndex());
if(Boolean.TRUE.equals(message.getDeleted())) {
dto.setDeleted(true);
} else {
dto.setContent(message.getContent());
dto.setDices(message.getDices());
}
final Key author = message.getAuthor();
dto.setAuthor(author == null ? null : author.getId());
return dto;
}