Search in sources :

Example 1 with BankOrderRepository

use of com.axelor.apps.bankpayment.db.repo.BankOrderRepository in project axelor-open-suite by axelor.

the class BankOrderController method merge.

@SuppressWarnings("unchecked")
public void merge(ActionRequest request, ActionResponse response) {
    try {
        List<Integer> listSelectedBankOrder = (List<Integer>) request.getContext().get("_ids");
        BankOrderRepository bankOrderRepository = Beans.get(BankOrderRepository.class);
        List<BankOrder> bankOrderList = Lists.newArrayList();
        if (listSelectedBankOrder != null) {
            for (Integer bankOrderId : listSelectedBankOrder) {
                BankOrder bankOrder = bankOrderRepository.find(bankOrderId.longValue());
                if (bankOrder != null) {
                    bankOrderList.add(bankOrder);
                }
            }
            BankOrder bankOrder = Beans.get(BankOrderMergeService.class).mergeBankOrders(bankOrderList);
            response.setView(ActionView.define(I18n.get("Bank Order")).model(BankOrder.class.getName()).add("form", "bank-order-form").param("forceEdit", "true").context("_showRecord", String.valueOf(bankOrder.getId())).map());
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : BankOrderMergeService(com.axelor.apps.bankpayment.service.bankorder.BankOrderMergeService) List(java.util.List) BankOrderRepository(com.axelor.apps.bankpayment.db.repo.BankOrderRepository) BankOrder(com.axelor.apps.bankpayment.db.BankOrder) AxelorException(com.axelor.exception.AxelorException)

Aggregations

BankOrder (com.axelor.apps.bankpayment.db.BankOrder)1 BankOrderRepository (com.axelor.apps.bankpayment.db.repo.BankOrderRepository)1 BankOrderMergeService (com.axelor.apps.bankpayment.service.bankorder.BankOrderMergeService)1 AxelorException (com.axelor.exception.AxelorException)1 List (java.util.List)1