class NoteMapper implements DataMapper<Note, NoteDto> {

  @Override
  public Note mapDtoToEntity(NoteDto noteDto) {
    Note note = new Note();

    note.setText(noteDto.getNoteBody());
    note.setId(noteDto.getNoteId());
    note.setUserId(noteDto.getUserId());
    note.setDate(noteDto.getDate());

    KeyResult parentKeyResult = null;
    if (noteDto.getParentKeyResultId() != null) {
      parentKeyResult = new KeyResult();
      parentKeyResult.setId(noteDto.getParentKeyResultId());
    }
    note.setParentKeyResult(parentKeyResult);

    logger.info("Mapped NoteDto (id:" + noteDto.getNoteId() + ") successful to Note.");
    return note;
  }

}