Search in sources :

Example 36 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class CrmBatchService method run.

@Override
public Batch run(Model batchModel) throws AxelorException {
    Batch batch;
    CrmBatch crmBatch = (CrmBatch) batchModel;
    switch(crmBatch.getActionSelect()) {
        case CrmBatchRepository.ACTION_BATCH_EVENT_REMINDER:
            batch = eventReminder(crmBatch);
            break;
        case CrmBatchRepository.ACTION_BATCH_TARGET:
            batch = target(crmBatch);
            break;
        default:
            throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_1), crmBatch.getActionSelect(), crmBatch.getCode());
    }
    return batch;
}
Also used : AxelorException(com.axelor.exception.AxelorException) Batch(com.axelor.apps.base.db.Batch) CrmBatch(com.axelor.apps.crm.db.CrmBatch) CrmBatch(com.axelor.apps.crm.db.CrmBatch)

Example 37 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class BankPaymentBatchService method run.

@Override
public Batch run(Model batchModel) throws AxelorException {
    Batch batch;
    BankPaymentBatch bankPaymentBatch = (BankPaymentBatch) batchModel;
    switch(bankPaymentBatch.getActionSelect()) {
        case BankPaymentBatchRepository.ACTION_EBICS_CERTIFICATE:
            batch = ebicsCertificate(bankPaymentBatch);
            break;
        case BankPaymentBatchRepository.ACTION_BANK_STATEMENT:
            batch = bankStatement(bankPaymentBatch);
            break;
        default:
            throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_1), bankPaymentBatch.getActionSelect(), bankPaymentBatch.getCode());
    }
    return batch;
}
Also used : AxelorException(com.axelor.exception.AxelorException) Batch(com.axelor.apps.base.db.Batch) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch)

Example 38 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class BankPaymentBatchController method actionEbicsCertificate.

public void actionEbicsCertificate(ActionRequest request, ActionResponse response) {
    BankPaymentBatch bankPaymentBatch = request.getContext().asType(BankPaymentBatch.class);
    bankPaymentBatch = Beans.get(BankPaymentBatchRepository.class).find(bankPaymentBatch.getId());
    Batch batch = Beans.get(BatchEbicsCertificate.class).ebicsCertificate(bankPaymentBatch);
    if (batch != null) {
        response.setFlash(batch.getComments());
    }
    response.setReload(true);
}
Also used : Batch(com.axelor.apps.base.db.Batch) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch) BatchEbicsCertificate(com.axelor.apps.bankpayment.service.batch.BatchEbicsCertificate)

Example 39 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class ProjectInvoicingAssistantBatchService method run.

@Override
public Batch run(Model model) throws AxelorException {
    Batch batch;
    ProjectInvoicingAssistantBatch projectInvoicingAssistantBatch = (ProjectInvoicingAssistantBatch) model;
    switch(projectInvoicingAssistantBatch.getActionSelect()) {
        case ProjectInvoicingAssistantBatchRepository.ACTION_UPDATE_TASKS:
            batch = updateTask(projectInvoicingAssistantBatch);
            break;
        case ProjectInvoicingAssistantBatchRepository.ACTION_GENERATE_INVOICING_PROJECT:
            batch = generateInvoicingProject(projectInvoicingAssistantBatch);
            break;
        default:
            throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_1), projectInvoicingAssistantBatch.getActionSelect(), projectInvoicingAssistantBatch.getCode());
    }
    return batch;
}
Also used : AxelorException(com.axelor.exception.AxelorException) Batch(com.axelor.apps.base.db.Batch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch)

Example 40 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class ProjectInvoicingAssistantBatchController method actionGenerateInvoicingProject.

public void actionGenerateInvoicingProject(ActionRequest request, ActionResponse response) {
    try {
        ProjectInvoicingAssistantBatch projectInvoicingAssistantBatch = request.getContext().asType(ProjectInvoicingAssistantBatch.class);
        projectInvoicingAssistantBatch = Beans.get(ProjectInvoicingAssistantBatchRepository.class).find(projectInvoicingAssistantBatch.getId());
        Batch batch = Beans.get(ProjectInvoicingAssistantBatchService.class).generateInvoicingProject(projectInvoicingAssistantBatch);
        response.setFlash(batch.getComments());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    } finally {
        response.setReload(true);
    }
}
Also used : Batch(com.axelor.apps.base.db.Batch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch) ProjectInvoicingAssistantBatchService(com.axelor.apps.businessproject.service.batch.ProjectInvoicingAssistantBatchService)

Aggregations

Batch (com.axelor.apps.base.db.Batch)43 AccountingBatch (com.axelor.apps.account.db.AccountingBatch)12 AxelorException (com.axelor.exception.AxelorException)12 AccountingBatchService (com.axelor.apps.account.service.batch.AccountingBatchService)6 AccountingBatchRepository (com.axelor.apps.account.db.repo.AccountingBatchRepository)5 HashMap (java.util.HashMap)5 CrmBatch (com.axelor.apps.crm.db.CrmBatch)4 InvoiceBatch (com.axelor.apps.account.db.InvoiceBatch)3 BankPaymentBatch (com.axelor.apps.bankpayment.db.BankPaymentBatch)3 ProjectInvoicingAssistantBatch (com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch)3 CrmBatchService (com.axelor.apps.crm.service.batch.CrmBatchService)3 SupplychainBatch (com.axelor.apps.supplychain.db.SupplychainBatch)3 SupplychainBatchService (com.axelor.apps.supplychain.service.batch.SupplychainBatchService)3 InvoiceBatchService (com.axelor.apps.account.service.invoice.InvoiceBatchService)2 BaseBatch (com.axelor.apps.base.db.BaseBatch)2 MailBatch (com.axelor.apps.base.db.MailBatch)2 MailBatchRepository (com.axelor.apps.base.db.repo.MailBatchRepository)2 ProjectInvoicingAssistantBatchService (com.axelor.apps.businessproject.service.batch.ProjectInvoicingAssistantBatchService)2 Account (com.axelor.apps.account.db.Account)1 AccountConfig (com.axelor.apps.account.db.AccountConfig)1