1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
/**
* @param societyCode
* @param societeRefDataMap
* @return Le nom AD si il existe
* @throws ReportPtgFileException
*/
public String findNomADSocietyByCode(String societyCode, Map<Integer, SocieteRefData> societeRefDataMap)
throws ReportPtgFileException {
Integer societyCodeInteger = Integer.parseInt(societyCode);
return Optional.ofNullable(societeRefDataMap.get(societyCodeInteger)).map(SocieteRefData::getNomAd)
.orElseThrow(() -> ReportPtgFileException.build(Constants.PRH_ERROR_CODE_REJET)
.withMessage(MessageConstants.REJ_CODE_SOCIETE, societyCode));
} |
Partager