FINERACT-2446: Tax Group and Tax Component APIs return HTTP 500 when no record is found (empty result), instead of returning a proper HTTP 404 Not Found
This commit is contained in:
+6
-2
@@ -25,7 +25,9 @@ import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformServi
|
||||
import org.apache.fineract.portfolio.tax.data.TaxComponentData;
|
||||
import org.apache.fineract.portfolio.tax.data.TaxGroupData;
|
||||
import org.apache.fineract.portfolio.tax.domain.TaxComponentRepository;
|
||||
import org.apache.fineract.portfolio.tax.domain.TaxComponentRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.tax.domain.TaxGroupRepository;
|
||||
import org.apache.fineract.portfolio.tax.domain.TaxGroupRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.tax.mapper.TaxComponentMapper;
|
||||
import org.apache.fineract.portfolio.tax.mapper.TaxGroupMapper;
|
||||
|
||||
@@ -34,8 +36,10 @@ public class TaxReadPlatformServiceImpl implements TaxReadPlatformService {
|
||||
|
||||
private final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService;
|
||||
private final TaxComponentRepository taxComponentRepository;
|
||||
private final TaxComponentRepositoryWrapper taxComponentRepositoryWrapper;
|
||||
private final TaxComponentMapper taxComponentMapper;
|
||||
private final TaxGroupRepository taxGroupRepository;
|
||||
private final TaxGroupRepositoryWrapper taxGroupRepositoryWrapper;
|
||||
private final TaxGroupMapper taxGroupMapper;
|
||||
|
||||
@Override
|
||||
@@ -45,7 +49,7 @@ public class TaxReadPlatformServiceImpl implements TaxReadPlatformService {
|
||||
|
||||
@Override
|
||||
public TaxComponentData retrieveTaxComponentData(final Long id) {
|
||||
return taxComponentMapper.map(taxComponentRepository.getReferenceById(id));
|
||||
return taxComponentMapper.map(taxComponentRepositoryWrapper.findOneWithNotFoundDetection(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,7 +65,7 @@ public class TaxReadPlatformServiceImpl implements TaxReadPlatformService {
|
||||
|
||||
@Override
|
||||
public TaxGroupData retrieveTaxGroupData(final Long id) {
|
||||
return taxGroupMapper.map(taxGroupRepository.getReferenceById(id));
|
||||
return taxGroupMapper.map(taxGroupRepositoryWrapper.findOneWithNotFoundDetection(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-4
@@ -50,10 +50,11 @@ public class TaxConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(TaxReadPlatformService.class)
|
||||
public TaxReadPlatformService taxReadPlatformService(final TaxComponentRepository taxComponentRepository,
|
||||
final TaxComponentMapper taxComponentMapper, final TaxGroupRepository taxGroupRepository, final TaxGroupMapper taxGroupMapper,
|
||||
AccountingDropdownReadPlatformService accountingDropdownReadPlatformService) {
|
||||
return new TaxReadPlatformServiceImpl(accountingDropdownReadPlatformService, taxComponentRepository, taxComponentMapper,
|
||||
taxGroupRepository, taxGroupMapper);
|
||||
final TaxComponentRepositoryWrapper taxComponentRepositoryWrapper, final TaxComponentMapper taxComponentMapper,
|
||||
final TaxGroupRepository taxGroupRepository, final TaxGroupRepositoryWrapper taxGroupRepositoryWrapper,
|
||||
final TaxGroupMapper taxGroupMapper, AccountingDropdownReadPlatformService accountingDropdownReadPlatformService) {
|
||||
return new TaxReadPlatformServiceImpl(accountingDropdownReadPlatformService, taxComponentRepository, taxComponentRepositoryWrapper,
|
||||
taxComponentMapper, taxGroupRepository, taxGroupRepositoryWrapper, taxGroupMapper);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user