@Test public void test_delete_with_kafka() { List<InstrumentAccountCode> expectedResult = getInstrumentAccountCodes(); instrumentAccountCodeRepositoryWithKafka.delete(expectedResult, requestInfo); verify(instrumentAccountCodeQueueRepository).addToQue(captor.capture()); final InstrumentAccountCodeRequest actualRequest = captor.getValue(); assertEquals(expectedResult.get(0).getInstrumentType().getName(), actualRequest.getInstrumentAccountCodes().get(0).getInstrumentType().getName()); assertEquals(expectedResult.get(0).getAccountCode().getGlcode(), actualRequest.getInstrumentAccountCodes().get(0).getAccountCode().getGlcode()); assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getInstrumentAccountCodes().get(0).getTenantId()); }
@Transactional public List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes, RequestInfo requestInfo) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentAccountCodes(new ArrayList<>()); for (InstrumentAccountCode iac : instrumentAccountCodes) request.getInstrumentAccountCodes().add(mapper.toContract(iac)); instrumentAccountCodeQueueRepository.addToQue(request); return instrumentAccountCodes; } else { List<InstrumentAccountCode> resultList = new ArrayList<InstrumentAccountCode>(); for (InstrumentAccountCode iac : instrumentAccountCodes) resultList.add(delete(iac)); InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentAccountCodes(new ArrayList<>()); for (InstrumentAccountCode iac : resultList) request.getInstrumentAccountCodes().add(mapper.toContract(iac)); instrumentAccountCodeQueueRepository.addToSearchQue(request); return resultList; } }
InstrumentAccountCodeRepository { @Transactional public List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes, RequestInfo requestInfo) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentAccountCodes(new ArrayList<>()); for (InstrumentAccountCode iac : instrumentAccountCodes) request.getInstrumentAccountCodes().add(mapper.toContract(iac)); instrumentAccountCodeQueueRepository.addToQue(request); return instrumentAccountCodes; } else { List<InstrumentAccountCode> resultList = new ArrayList<InstrumentAccountCode>(); for (InstrumentAccountCode iac : instrumentAccountCodes) resultList.add(delete(iac)); InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentAccountCodes(new ArrayList<>()); for (InstrumentAccountCode iac : resultList) request.getInstrumentAccountCodes().add(mapper.toContract(iac)); instrumentAccountCodeQueueRepository.addToSearchQue(request); return resultList; } } }
InstrumentAccountCodeRepository { @Transactional public List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes, RequestInfo requestInfo) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentAccountCodes(new ArrayList<>()); for (InstrumentAccountCode iac : instrumentAccountCodes) request.getInstrumentAccountCodes().add(mapper.toContract(iac)); instrumentAccountCodeQueueRepository.addToQue(request); return instrumentAccountCodes; } else { List<InstrumentAccountCode> resultList = new ArrayList<InstrumentAccountCode>(); for (InstrumentAccountCode iac : instrumentAccountCodes) resultList.add(delete(iac)); InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentAccountCodes(new ArrayList<>()); for (InstrumentAccountCode iac : resultList) request.getInstrumentAccountCodes().add(mapper.toContract(iac)); instrumentAccountCodeQueueRepository.addToSearchQue(request); return resultList; } } @Autowired  InstrumentAccountCodeRepository(InstrumentAccountCodeJdbcRepository instrumentAccountCodeJdbcRepository,
            InstrumentAccountCodeQueueRepository instrumentAccountCodeQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka,
            InstrumentAccountCodeESRepository instrumentAccountCodeESRepository,
            FinancialConfigurationContractRepository financialConfigurationContractRepository); }
InstrumentAccountCodeRepository { @Transactional public List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes, RequestInfo requestInfo) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentAccountCodes(new ArrayList<>()); for (InstrumentAccountCode iac : instrumentAccountCodes) request.getInstrumentAccountCodes().add(mapper.toContract(iac)); instrumentAccountCodeQueueRepository.addToQue(request); return instrumentAccountCodes; } else { List<InstrumentAccountCode> resultList = new ArrayList<InstrumentAccountCode>(); for (InstrumentAccountCode iac : instrumentAccountCodes) resultList.add(delete(iac)); InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentAccountCodes(new ArrayList<>()); for (InstrumentAccountCode iac : resultList) request.getInstrumentAccountCodes().add(mapper.toContract(iac)); instrumentAccountCodeQueueRepository.addToSearchQue(request); return resultList; } } @Autowired  InstrumentAccountCodeRepository(InstrumentAccountCodeJdbcRepository instrumentAccountCodeJdbcRepository,
            InstrumentAccountCodeQueueRepository instrumentAccountCodeQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka,
            InstrumentAccountCodeESRepository instrumentAccountCodeESRepository,
            FinancialConfigurationContractRepository financialConfigurationContractRepository); InstrumentAccountCode findById(InstrumentAccountCode instrumentAccountCode); @Transactional List<InstrumentAccountCode> save(List<InstrumentAccountCode> instrumentAccountCodes,
            RequestInfo requestInfo); @Transactional List<InstrumentAccountCode> update(List<InstrumentAccountCode> instrumentAccountCodes,
            RequestInfo requestInfo); @Transactional List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes,
            RequestInfo requestInfo); @Transactional InstrumentAccountCode save(InstrumentAccountCode instrumentAccountCode); @Transactional InstrumentAccountCode update(InstrumentAccountCode instrumentAccountCode); @Transactional InstrumentAccountCode delete(InstrumentAccountCode instrumentAccountCode); Pagination<InstrumentAccountCode> search(InstrumentAccountCodeSearch domain); boolean uniqueCheck(String fieldName, InstrumentAccountCode instrumentAccountCode); }
InstrumentAccountCodeRepository { @Transactional public List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes, RequestInfo requestInfo) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentAccountCodes(new ArrayList<>()); for (InstrumentAccountCode iac : instrumentAccountCodes) request.getInstrumentAccountCodes().add(mapper.toContract(iac)); instrumentAccountCodeQueueRepository.addToQue(request); return instrumentAccountCodes; } else { List<InstrumentAccountCode> resultList = new ArrayList<InstrumentAccountCode>(); for (InstrumentAccountCode iac : instrumentAccountCodes) resultList.add(delete(iac)); InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentAccountCodes(new ArrayList<>()); for (InstrumentAccountCode iac : resultList) request.getInstrumentAccountCodes().add(mapper.toContract(iac)); instrumentAccountCodeQueueRepository.addToSearchQue(request); return resultList; } } @Autowired  InstrumentAccountCodeRepository(InstrumentAccountCodeJdbcRepository instrumentAccountCodeJdbcRepository,
            InstrumentAccountCodeQueueRepository instrumentAccountCodeQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka,
            InstrumentAccountCodeESRepository instrumentAccountCodeESRepository,
            FinancialConfigurationContractRepository financialConfigurationContractRepository); InstrumentAccountCode findById(InstrumentAccountCode instrumentAccountCode); @Transactional List<InstrumentAccountCode> save(List<InstrumentAccountCode> instrumentAccountCodes,
            RequestInfo requestInfo); @Transactional List<InstrumentAccountCode> update(List<InstrumentAccountCode> instrumentAccountCodes,
            RequestInfo requestInfo); @Transactional List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes,
            RequestInfo requestInfo); @Transactional InstrumentAccountCode save(InstrumentAccountCode instrumentAccountCode); @Transactional InstrumentAccountCode update(InstrumentAccountCode instrumentAccountCode); @Transactional InstrumentAccountCode delete(InstrumentAccountCode instrumentAccountCode); Pagination<InstrumentAccountCode> search(InstrumentAccountCodeSearch domain); boolean uniqueCheck(String fieldName, InstrumentAccountCode instrumentAccountCode);  }