mifosx-567 ensure duplicate externalId for staff and loan general valid json error response
This commit is contained in:
+1
-1
@@ -98,7 +98,7 @@ public class StaffWritePlatformServiceJpaRepositoryImpl implements StaffWritePla
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!changesOnly.isEmpty()) {
|
if (!changesOnly.isEmpty()) {
|
||||||
this.staffRepository.save(staffForUpdate);
|
this.staffRepository.saveAndFlush(staffForUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(staffId)
|
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(staffId)
|
||||||
|
|||||||
+8
-3
@@ -140,6 +140,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult submitApplication(final JsonCommand command) {
|
public CommandProcessingResult submitApplication(final JsonCommand command) {
|
||||||
|
|
||||||
|
try {
|
||||||
final AppUser currentUser = context.authenticatedUser();
|
final AppUser currentUser = context.authenticatedUser();
|
||||||
|
|
||||||
this.fromApiJsonDeserializer.validateForCreate(command.json());
|
this.fromApiJsonDeserializer.validateForCreate(command.json());
|
||||||
@@ -201,8 +202,12 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
.withGroupId(newLoanApplication.getGroupId()) //
|
.withGroupId(newLoanApplication.getGroupId()) //
|
||||||
.withLoanId(newLoanApplication.getId()) //
|
.withLoanId(newLoanApplication.getId()) //
|
||||||
.build();
|
.build();
|
||||||
|
} catch (DataIntegrityViolationException dve) {
|
||||||
|
handleDataIntegrityIssues(command, dve);
|
||||||
|
return CommandProcessingResult.empty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult modifyApplication(final Long loanId, final JsonCommand command) {
|
public CommandProcessingResult modifyApplication(final Long loanId, final JsonCommand command) {
|
||||||
@@ -379,8 +384,8 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
|
|
||||||
logAsErrorUnexpectedDataIntegrityException(dve);
|
logAsErrorUnexpectedDataIntegrityException(dve);
|
||||||
throw new PlatformDataIntegrityException("error.msg.unknown.data.integrity.issue", "Unknown data integrity issue with resource.");
|
throw new PlatformDataIntegrityException("error.msg.unknown.data.integrity.issue", "Unknown data integrity issue with resource.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logAsErrorUnexpectedDataIntegrityException(final DataIntegrityViolationException dve) {
|
private void logAsErrorUnexpectedDataIntegrityException(final DataIntegrityViolationException dve) {
|
||||||
logger.error(dve.getMessage(), dve);
|
logger.error(dve.getMessage(), dve);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user