@Test public void test_save() { final BudgetReAppropriationEntity entity = getBudgetReAppropriationEntity(); final BudgetReAppropriation expectedResult = entity.toDomain(); when(budgetReAppropriationJdbcRepository.create(any(BudgetReAppropriationEntity.class))).thenReturn(entity); final BudgetReAppropriation actualResult = budgetReAppropriationRepositoryWithKafka .save(getBudgetReAppropriationDomin()); assertEquals(expectedResult.getAnticipatoryAmount(), actualResult.getAnticipatoryAmount()); assertEquals(expectedResult.getAdditionAmount(), actualResult.getAdditionAmount()); assertEquals(expectedResult.getDeductionAmount(), actualResult.getDeductionAmount()); assertEquals(expectedResult.getOriginalAdditionAmount(), actualResult.getOriginalAdditionAmount()); assertEquals(expectedResult.getOriginalDeductionAmount(), actualResult.getOriginalDeductionAmount()); }
@Transactional public List<BudgetReAppropriation> save(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(save(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> save(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(save(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> save(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(save(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> save(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(save(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> save(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(save(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);  }