Search in sources :

Example 1 with FamilyMapDTO

use of py.org.fundacionparaguaya.pspserver.families.dtos.FamilyMapDTO in project FP-PSP-SERVER by FundacionParaguaya.

the class FamilySnapshotsManagerImpl method getFamilyMapById.

@Override
public FamilyMapDTO getFamilyMapById(Long familyId) {
    checkArgument(familyId > 0, i18n.translate("argument.nonNegative", familyId));
    FamilyMapDTO familyFile = new FamilyMapDTO();
    FamilyDTO family = Optional.ofNullable(familyRepository.findOne(familyId)).map(familyMapper::entityToDto).orElseThrow(() -> new UnknownResourceException(i18n.translate("family.notExist")));
    BeanUtils.copyProperties(family, familyFile);
    familyFile.setSnapshotIndicators(snapshotService.getLastSnapshotIndicatorsByFamily(familyId));
    return familyFile;
}
Also used : FamilyMapDTO(py.org.fundacionparaguaya.pspserver.families.dtos.FamilyMapDTO) UnknownResourceException(py.org.fundacionparaguaya.pspserver.common.exceptions.UnknownResourceException) FamilyDTO(py.org.fundacionparaguaya.pspserver.families.dtos.FamilyDTO)

Aggregations

UnknownResourceException (py.org.fundacionparaguaya.pspserver.common.exceptions.UnknownResourceException)1 FamilyDTO (py.org.fundacionparaguaya.pspserver.families.dtos.FamilyDTO)1 FamilyMapDTO (py.org.fundacionparaguaya.pspserver.families.dtos.FamilyMapDTO)1