class OkrCompanyMapper implements DataMapper<OkrCompany, OkrCompanyDto> {

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

    okrCompanyDto.setOkrUnitId(okrCompany.getId());
    okrCompanyDto.setUnitName(okrCompany.getName());
    okrCompanyDto.setLabel(okrCompany.getLabel());
    okrCompanyDto.setCycleId(okrCompany.getCycle().getId());
    okrCompanyDto.setHistoryId(okrCompany.getHistory().getId());

    Collection<Long> departmentIds = new ArrayList<>();
    for (OkrChildUnit okrChildUnit : okrCompany.getOkrChildUnits()) {
      departmentIds.add(okrChildUnit.getId());
    }
    okrCompanyDto.setOkrChildUnitIds(departmentIds);

    Collection<Long> objectiveIds = new ArrayList<>();
    for (Objective objective : okrCompany.getObjectives()) {
      objectiveIds.add(objective.getId());
    }
    okrCompanyDto.setObjectiveIds(objectiveIds);

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

}