class BudgetReAppropriationRepository {

    public Pagination<BudgetReAppropriation> search(final BudgetReAppropriationSearch domain) {

        if (financialConfigurationContractRepository.fetchDataFrom() != null
                && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) {

            BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper();
            BudgetReAppropriationSearchContract budgetReAppropriationSearchContract = new BudgetReAppropriationSearchContract();
            budgetReAppropriationSearchContract = mapper.toSearchContract(domain);
            Pagination<BudgetReAppropriation> budgetReAppropriations = budgetReAppropriationESRepository.search(budgetReAppropriationSearchContract);
            return budgetReAppropriations;
        } else {
            return budgetReAppropriationJdbcRepository.search(domain);
        }

    }

    @Autowired public  BudgetReAppropriationRepository(final BudgetReAppropriationJdbcRepository budgetReAppropriationJdbcRepository,
                                           final BudgetReAppropriationQueueRepository budgetReAppropriationQueueRepository,
                                           @Value("${persist.through.kafka}") final String persistThroughKafka,
                                           FinancialConfigurationContractRepository financialConfigurationContractRepository,
                                           BudgetReAppropriationESRepository budgetReAppropriationESRepository
    );

}