use of py.org.fundacionparaguaya.pspserver.common.exceptions.UnknownResourceException in project FP-PSP-SERVER by FundacionParaguaya.
the class UserRoleServiceImpl method updateUserRole.
@Override
public UserRoleDTO updateUserRole(Long userRoleId, UserRoleDTO userRoleDTO) {
checkArgument(userRoleId > 0, "Argument was %s but expected nonnegative", userRoleId);
return Optional.ofNullable(userRoleRepository.findOne(userRoleId)).map(userRole -> {
BeanUtils.copyProperties(userRoleDTO, userRole);
LOG.debug("Changed Information for User role: {}", userRole);
return userRole;
}).map(userRoleMapper::entityToDto).orElseThrow(() -> new UnknownResourceException("User role does not exist"));
}
use of py.org.fundacionparaguaya.pspserver.common.exceptions.UnknownResourceException 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;
}
Aggregations