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.TaxComponentData;
|
||||||
import org.apache.fineract.portfolio.tax.data.TaxGroupData;
|
import org.apache.fineract.portfolio.tax.data.TaxGroupData;
|
||||||
import org.apache.fineract.portfolio.tax.domain.TaxComponentRepository;
|
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.TaxGroupRepository;
|
||||||
|
import org.apache.fineract.portfolio.tax.domain.TaxGroupRepositoryWrapper;
|
||||||
import org.apache.fineract.portfolio.tax.mapper.TaxComponentMapper;
|
import org.apache.fineract.portfolio.tax.mapper.TaxComponentMapper;
|
||||||
import org.apache.fineract.portfolio.tax.mapper.TaxGroupMapper;
|
import org.apache.fineract.portfolio.tax.mapper.TaxGroupMapper;
|
||||||
|
|
||||||
@@ -34,8 +36,10 @@ public class TaxReadPlatformServiceImpl implements TaxReadPlatformService {
|
|||||||
|
|
||||||
private final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService;
|
private final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService;
|
||||||
private final TaxComponentRepository taxComponentRepository;
|
private final TaxComponentRepository taxComponentRepository;
|
||||||
|
private final TaxComponentRepositoryWrapper taxComponentRepositoryWrapper;
|
||||||
private final TaxComponentMapper taxComponentMapper;
|
private final TaxComponentMapper taxComponentMapper;
|
||||||
private final TaxGroupRepository taxGroupRepository;
|
private final TaxGroupRepository taxGroupRepository;
|
||||||
|
private final TaxGroupRepositoryWrapper taxGroupRepositoryWrapper;
|
||||||
private final TaxGroupMapper taxGroupMapper;
|
private final TaxGroupMapper taxGroupMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,7 +49,7 @@ public class TaxReadPlatformServiceImpl implements TaxReadPlatformService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaxComponentData retrieveTaxComponentData(final Long id) {
|
public TaxComponentData retrieveTaxComponentData(final Long id) {
|
||||||
return taxComponentMapper.map(taxComponentRepository.getReferenceById(id));
|
return taxComponentMapper.map(taxComponentRepositoryWrapper.findOneWithNotFoundDetection(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -61,7 +65,7 @@ public class TaxReadPlatformServiceImpl implements TaxReadPlatformService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaxGroupData retrieveTaxGroupData(final Long id) {
|
public TaxGroupData retrieveTaxGroupData(final Long id) {
|
||||||
return taxGroupMapper.map(taxGroupRepository.getReferenceById(id));
|
return taxGroupMapper.map(taxGroupRepositoryWrapper.findOneWithNotFoundDetection(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+5
-4
@@ -50,10 +50,11 @@ public class TaxConfiguration {
|
|||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean(TaxReadPlatformService.class)
|
@ConditionalOnMissingBean(TaxReadPlatformService.class)
|
||||||
public TaxReadPlatformService taxReadPlatformService(final TaxComponentRepository taxComponentRepository,
|
public TaxReadPlatformService taxReadPlatformService(final TaxComponentRepository taxComponentRepository,
|
||||||
final TaxComponentMapper taxComponentMapper, final TaxGroupRepository taxGroupRepository, final TaxGroupMapper taxGroupMapper,
|
final TaxComponentRepositoryWrapper taxComponentRepositoryWrapper, final TaxComponentMapper taxComponentMapper,
|
||||||
AccountingDropdownReadPlatformService accountingDropdownReadPlatformService) {
|
final TaxGroupRepository taxGroupRepository, final TaxGroupRepositoryWrapper taxGroupRepositoryWrapper,
|
||||||
return new TaxReadPlatformServiceImpl(accountingDropdownReadPlatformService, taxComponentRepository, taxComponentMapper,
|
final TaxGroupMapper taxGroupMapper, AccountingDropdownReadPlatformService accountingDropdownReadPlatformService) {
|
||||||
taxGroupRepository, taxGroupMapper);
|
return new TaxReadPlatformServiceImpl(accountingDropdownReadPlatformService, taxComponentRepository, taxComponentRepositoryWrapper,
|
||||||
|
taxComponentMapper, taxGroupRepository, taxGroupRepositoryWrapper, taxGroupMapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
Reference in New Issue
Block a user