class KeyResultMapper implements DataMapper<KeyResult, KeyResultDto> {

  @Override
  public KeyResultDto mapEntityToDto(KeyResult keyResult) {
    KeyResultDto keyResultDto = new KeyResultDto();

    keyResultDto.setId(keyResult.getId());
    keyResultDto.setParentObjectiveId(keyResult.getParentObjective().getId());
    keyResultDto.setTitle(keyResult.getName());
    keyResultDto.setDescription(keyResult.getDescription());
    keyResultDto.setUnit(keyResult.getUnit());

    keyResultDto.setStartValue(keyResult.getStartValue());
    keyResultDto.setCurrentValue(keyResult.getCurrentValue());
    keyResultDto.setTargetValue(keyResult.getTargetValue());
    keyResultDto.setSequence(keyResult.getSequence());

    Collection<Long> noteIds = new ArrayList<>();
    for (Note note : keyResult.getNotes()) {
      noteIds.add(note.getId());
    }
    keyResultDto.setNoteIds(noteIds);

    logger.info("Mapped KeyResult (id:" + keyResult.getId() + ") to KeyResultDto.");
    return keyResultDto;
  }

}