@Test public void test_delete_with_kafka() { final List<BudgetReAppropriation> expectedResult = getBudgetReAppropriations(); budgetReAppropriationRepositoryWithKafka.delete(expectedResult, requestInfo); verify(budgetReAppropriationQueueRepository).addToQue(captor.capture()); final BudgetReAppropriationRequest actualRequest = captor.getValue(); assertEquals(expectedResult.get(0).getAnticipatoryAmount(), actualRequest.getBudgetReAppropriations().get(0).getAnticipatoryAmount()); assertEquals(expectedResult.get(0).getAdditionAmount(), actualRequest.getBudgetReAppropriations().get(0).getAdditionAmount()); assertEquals(expectedResult.get(0).getDeductionAmount(), actualRequest.getBudgetReAppropriations().get(0).getDeductionAmount()); assertEquals(expectedResult.get(0).getOriginalAdditionAmount(), actualRequest.getBudgetReAppropriations().get(0).getOriginalAdditionAmount()); assertEquals(expectedResult.get(0).getOriginalDeductionAmount(), actualRequest.getBudgetReAppropriations().get(0).getOriginalDeductionAmount()); }
@Transactional public List<BudgetReAppropriation> delete(final List<BudgetReAppropriation> budgetReAppropriations, final RequestInfo requestInfo) { final BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { final BudgetReAppropriationRequest request = new BudgetReAppropriationRequest(); request.setRequestInfo(requestInfo); request.setBudgetReAppropriations(new ArrayList<>()); for (final BudgetReAppropriation iac : budgetReAppropriations) request.getBudgetReAppropriations().add(mapper.toContract(iac)); budgetReAppropriationQueueRepository.addToQue(request); return budgetReAppropriations; } else { final List<BudgetReAppropriation> resultList = new ArrayList<BudgetReAppropriation>(); for (final BudgetReAppropriation iac : budgetReAppropriations) resultList.add(delete(iac)); final BudgetReAppropriationRequest request = new BudgetReAppropriationRequest(); request.setRequestInfo(requestInfo); request.setBudgetReAppropriations(new ArrayList<>()); for (final BudgetReAppropriation iac : resultList) request.getBudgetReAppropriations().add(mapper.toContract(iac)); budgetReAppropriationQueueRepository.addToSearchQue(request); return resultList; } }
BudgetReAppropriationRepository { @Transactional public List<BudgetReAppropriation> delete(final List<BudgetReAppropriation> budgetReAppropriations, final RequestInfo requestInfo) { final BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { final BudgetReAppropriationRequest request = new BudgetReAppropriationRequest(); request.setRequestInfo(requestInfo); request.setBudgetReAppropriations(new ArrayList<>()); for (final BudgetReAppropriation iac : budgetReAppropriations) request.getBudgetReAppropriations().add(mapper.toContract(iac)); budgetReAppropriationQueueRepository.addToQue(request); return budgetReAppropriations; } else { final List<BudgetReAppropriation> resultList = new ArrayList<BudgetReAppropriation>(); for (final BudgetReAppropriation iac : budgetReAppropriations) resultList.add(delete(iac)); final BudgetReAppropriationRequest request = new BudgetReAppropriationRequest(); request.setRequestInfo(requestInfo); request.setBudgetReAppropriations(new ArrayList<>()); for (final BudgetReAppropriation iac : resultList) request.getBudgetReAppropriations().add(mapper.toContract(iac)); budgetReAppropriationQueueRepository.addToSearchQue(request); return resultList; } } }
BudgetReAppropriationRepository { @Transactional public List<BudgetReAppropriation> delete(final List<BudgetReAppropriation> budgetReAppropriations, final RequestInfo requestInfo) { final BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { final BudgetReAppropriationRequest request = new BudgetReAppropriationRequest(); request.setRequestInfo(requestInfo); request.setBudgetReAppropriations(new ArrayList<>()); for (final BudgetReAppropriation iac : budgetReAppropriations) request.getBudgetReAppropriations().add(mapper.toContract(iac)); budgetReAppropriationQueueRepository.addToQue(request); return budgetReAppropriations; } else { final List<BudgetReAppropriation> resultList = new ArrayList<BudgetReAppropriation>(); for (final BudgetReAppropriation iac : budgetReAppropriations) resultList.add(delete(iac)); final BudgetReAppropriationRequest request = new BudgetReAppropriationRequest(); request.setRequestInfo(requestInfo); request.setBudgetReAppropriations(new ArrayList<>()); for (final BudgetReAppropriation iac : resultList) request.getBudgetReAppropriations().add(mapper.toContract(iac)); budgetReAppropriationQueueRepository.addToSearchQue(request); return resultList; } } @Autowired  BudgetReAppropriationRepository(final BudgetReAppropriationJdbcRepository budgetReAppropriationJdbcRepository,
                                           final BudgetReAppropriationQueueRepository budgetReAppropriationQueueRepository,
                                           @Value("${persist.through.kafka}") final String persistThroughKafka,
                                           FinancialConfigurationContractRepository financialConfigurationContractRepository,
                                           BudgetReAppropriationESRepository budgetReAppropriationESRepository
    ); }
BudgetReAppropriationRepository { @Transactional public List<BudgetReAppropriation> delete(final List<BudgetReAppropriation> budgetReAppropriations, final RequestInfo requestInfo) { final BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { final BudgetReAppropriationRequest request = new BudgetReAppropriationRequest(); request.setRequestInfo(requestInfo); request.setBudgetReAppropriations(new ArrayList<>()); for (final BudgetReAppropriation iac : budgetReAppropriations) request.getBudgetReAppropriations().add(mapper.toContract(iac)); budgetReAppropriationQueueRepository.addToQue(request); return budgetReAppropriations; } else { final List<BudgetReAppropriation> resultList = new ArrayList<BudgetReAppropriation>(); for (final BudgetReAppropriation iac : budgetReAppropriations) resultList.add(delete(iac)); final BudgetReAppropriationRequest request = new BudgetReAppropriationRequest(); request.setRequestInfo(requestInfo); request.setBudgetReAppropriations(new ArrayList<>()); for (final BudgetReAppropriation iac : resultList) request.getBudgetReAppropriations().add(mapper.toContract(iac)); budgetReAppropriationQueueRepository.addToSearchQue(request); return resultList; } } @Autowired  BudgetReAppropriationRepository(final BudgetReAppropriationJdbcRepository budgetReAppropriationJdbcRepository,
                                           final BudgetReAppropriationQueueRepository budgetReAppropriationQueueRepository,
                                           @Value("${persist.through.kafka}") final String persistThroughKafka,
                                           FinancialConfigurationContractRepository financialConfigurationContractRepository,
                                           BudgetReAppropriationESRepository budgetReAppropriationESRepository
    ); BudgetReAppropriation findById(final BudgetReAppropriation budgetReAppropriation); @Transactional List<BudgetReAppropriation> save(final List<BudgetReAppropriation> budgetReAppropriations,
                                            final RequestInfo requestInfo); @Transactional List<BudgetReAppropriation> update(final List<BudgetReAppropriation> budgetReAppropriations,
                                              final RequestInfo requestInfo); @Transactional List<BudgetReAppropriation> delete(final List<BudgetReAppropriation> budgetReAppropriations,
                                              final RequestInfo requestInfo); @Transactional BudgetReAppropriation save(final BudgetReAppropriation budgetReAppropriation); @Transactional BudgetReAppropriation update(final BudgetReAppropriation entity); @Transactional BudgetReAppropriation delete(final BudgetReAppropriation entity); Pagination<BudgetReAppropriation> search(final BudgetReAppropriationSearch domain); boolean uniqueCheck(String fieldName, BudgetReAppropriation budgetReAppropriation); }
BudgetReAppropriationRepository { @Transactional public List<BudgetReAppropriation> delete(final List<BudgetReAppropriation> budgetReAppropriations, final RequestInfo requestInfo) { final BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { final BudgetReAppropriationRequest request = new BudgetReAppropriationRequest(); request.setRequestInfo(requestInfo); request.setBudgetReAppropriations(new ArrayList<>()); for (final BudgetReAppropriation iac : budgetReAppropriations) request.getBudgetReAppropriations().add(mapper.toContract(iac)); budgetReAppropriationQueueRepository.addToQue(request); return budgetReAppropriations; } else { final List<BudgetReAppropriation> resultList = new ArrayList<BudgetReAppropriation>(); for (final BudgetReAppropriation iac : budgetReAppropriations) resultList.add(delete(iac)); final BudgetReAppropriationRequest request = new BudgetReAppropriationRequest(); request.setRequestInfo(requestInfo); request.setBudgetReAppropriations(new ArrayList<>()); for (final BudgetReAppropriation iac : resultList) request.getBudgetReAppropriations().add(mapper.toContract(iac)); budgetReAppropriationQueueRepository.addToSearchQue(request); return resultList; } } @Autowired  BudgetReAppropriationRepository(final BudgetReAppropriationJdbcRepository budgetReAppropriationJdbcRepository,
                                           final BudgetReAppropriationQueueRepository budgetReAppropriationQueueRepository,
                                           @Value("${persist.through.kafka}") final String persistThroughKafka,
                                           FinancialConfigurationContractRepository financialConfigurationContractRepository,
                                           BudgetReAppropriationESRepository budgetReAppropriationESRepository
    ); BudgetReAppropriation findById(final BudgetReAppropriation budgetReAppropriation); @Transactional List<BudgetReAppropriation> save(final List<BudgetReAppropriation> budgetReAppropriations,
                                            final RequestInfo requestInfo); @Transactional List<BudgetReAppropriation> update(final List<BudgetReAppropriation> budgetReAppropriations,
                                              final RequestInfo requestInfo); @Transactional List<BudgetReAppropriation> delete(final List<BudgetReAppropriation> budgetReAppropriations,
                                              final RequestInfo requestInfo); @Transactional BudgetReAppropriation save(final BudgetReAppropriation budgetReAppropriation); @Transactional BudgetReAppropriation update(final BudgetReAppropriation entity); @Transactional BudgetReAppropriation delete(final BudgetReAppropriation entity); Pagination<BudgetReAppropriation> search(final BudgetReAppropriationSearch domain); boolean uniqueCheck(String fieldName, BudgetReAppropriation budgetReAppropriation);  }