}
if (changes.containsKey(ClientApiConstants.genderIdParamName)) {
final Long newValue = command.longValueOfParameterNamed(ClientApiConstants.genderIdParamName);
CodeValue gender = null;
if (newValue != null) {
gender = this.codeValueRepository.findOneByCodeNameAndIdWithNotFoundDetection(ClientApiConstants.GENDER, newValue);
}
clientForUpdate.updateGender(gender);
}
if (changes.containsKey(ClientApiConstants.savingsProductIdParamName)) {
if (clientForUpdate.isActive()) { throw new ClientActiveForUpdateException(clientId,
ClientApiConstants.savingsProductIdParamName); }
SavingsProduct savingsProduct = null;
final Long savingsProductId = command.longValueOfParameterNamed(ClientApiConstants.savingsProductIdParamName);
if (savingsProductId != null) {
savingsProduct = this.savingsProductRepository.findOne(savingsProductId);
if (savingsProduct == null) { throw new SavingsProductNotFoundException(savingsProductId); }
}
clientForUpdate.updateSavingsProduct(savingsProduct);
}
if (changes.containsKey(ClientApiConstants.genderIdParamName)) {
final Long newValue = command.longValueOfParameterNamed(ClientApiConstants.genderIdParamName);
CodeValue newCodeVal = null;
if (newValue != null) {
newCodeVal = this.codeValueRepository.findOneByCodeNameAndIdWithNotFoundDetection(ClientApiConstants.GENDER, newValue);
}
clientForUpdate.updateGender(newCodeVal);
}
if (changes.containsKey(ClientApiConstants.clientTypeIdParamName)) {
final Long newValue = command.longValueOfParameterNamed(ClientApiConstants.clientTypeIdParamName);
CodeValue newCodeVal = null;
if (newValue != null) {
newCodeVal = this.codeValueRepository.findOneByCodeNameAndIdWithNotFoundDetection(ClientApiConstants.CLIENT_TYPE,
newValue);
}
clientForUpdate.updateClientType(newCodeVal);
}
if (changes.containsKey(ClientApiConstants.clientClassificationIdParamName)) {
final Long newValue = command.longValueOfParameterNamed(ClientApiConstants.clientClassificationIdParamName);
CodeValue newCodeVal = null;
if (newValue != null) {
newCodeVal = this.codeValueRepository.findOneByCodeNameAndIdWithNotFoundDetection(
ClientApiConstants.CLIENT_CLASSIFICATION, newValue);
}
clientForUpdate.updateClientClassification(newCodeVal);