in scorecard-plugin/src/main/java/org/apache/fineract/portfolio/creditscorecard/service/CreditScorecardWritePlatformServiceImpl.java [131:155]
public CommandProcessingResult updateScoringFeature(Long featureId, JsonCommand command) {
try {
this.context.authenticatedUser();
this.fromApiJsonDeserializer.validateFeatureForUpdate(command.json());
final CreditScorecardFeature featureForUpdate = this.featureRepository.findById(featureId)
.orElseThrow(() -> new FeatureNotFoundException(featureId));
final Map<String, Object> changes = featureForUpdate.update(command);
if (!changes.isEmpty()) {
this.featureRepository.save(featureForUpdate);
}
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(featureId).with(changes).build();
} catch (final JpaSystemException | DataIntegrityViolationException dve) {
handleDataIntegrityIssues(command, dve.getMostSpecificCause(), dve);
return CommandProcessingResult.empty();
} catch (final PersistenceException dve) {
Throwable throwable = ExceptionUtils.getRootCause(dve.getCause());
handleDataIntegrityIssues(command, throwable, dve);
return CommandProcessingResult.empty();
}
}