class OkrCompanyMapper implements DataMapper<OkrCompany, OkrCompanyDto> {

  @Override
  public OkrCompany mapDtoToEntity(OkrCompanyDto okrCompanyDto) {
    OkrCompany okrCompany = new OkrCompany();

    okrCompany.setId(okrCompanyDto.getOkrUnitId());
    okrCompany.setName(okrCompanyDto.getUnitName());
    okrCompany.setLabel(okrCompanyDto.getLabel());

    okrCompany.setOkrChildUnits(new ArrayList<>());
    okrCompany.setObjectives(new ArrayList<>());

    Cycle cycle = null;
    if (okrCompanyDto.getCycleId() != null) {
      cycle = new Cycle();
      cycle.setId(okrCompanyDto.getCycleId());
    }
    okrCompany.setCycle(cycle);

    OkrCompanyHistory history = null;
    if (okrCompanyDto.getHistoryId() != null) {
      history = new OkrCompanyHistory();
      history.setId(okrCompanyDto.getHistoryId());
    }
    okrCompany.setHistory(history);

    logger.info("Mapped OkrCompanyDto (id:" + okrCompanyDto.getOkrUnitId() + ") to OkrCompany.");
    return okrCompany;
  }

}