Search in sources :

Example 21 with Contract

use of com.axelor.apps.contract.db.Contract in project axelor-open-suite by axelor.

the class BatchContract method process.

@Override
protected void process() {
    try {
        BatchContractFactory factory = getFactory(batch.getContractBatch().getActionSelect());
        Preconditions.checkNotNull(factory, String.format(I18n.get("Action %s has no Batch implementation."), batch.getContractBatch().getActionSelect()));
        Query<Contract> query = factory.prepare(batch);
        List<Contract> contracts;
        while (!(contracts = query.fetch(FETCH_LIMIT)).isEmpty()) {
            findBatch();
            for (Contract contract : contracts) {
                try {
                    factory.process(contract);
                    incrementDone(contract);
                } catch (Exception e) {
                    TraceBackService.trace(e);
                    incrementAnomaly(contract);
                }
            }
            JPA.clear();
        }
    } catch (Exception e) {
        TraceBackService.trace(e);
        LOG.error(e.getMessage());
    }
}
Also used : Contract(com.axelor.apps.contract.db.Contract)

Aggregations

Contract (com.axelor.apps.contract.db.Contract)21 ContractRepository (com.axelor.apps.contract.db.repo.ContractRepository)10 ContractVersion (com.axelor.apps.contract.db.ContractVersion)9 ContractService (com.axelor.apps.contract.service.ContractService)7 ContractLine (com.axelor.apps.contract.db.ContractLine)6 AxelorException (com.axelor.exception.AxelorException)5 InvoiceGeneratorContract (com.axelor.apps.contract.generator.InvoiceGeneratorContract)4 Invoice (com.axelor.apps.account.db.Invoice)3 ConsumptionLine (com.axelor.apps.contract.db.ConsumptionLine)3 ContractTemplate (com.axelor.apps.contract.db.ContractTemplate)3 ContractVersionRepository (com.axelor.apps.contract.db.repo.ContractVersionRepository)3 Account (com.axelor.apps.account.db.Account)2 AnalyticMoveLine (com.axelor.apps.account.db.AnalyticMoveLine)2 FiscalPosition (com.axelor.apps.account.db.FiscalPosition)2 InvoiceLine (com.axelor.apps.account.db.InvoiceLine)2 TaxLine (com.axelor.apps.account.db.TaxLine)2 AnalyticMoveLineRepository (com.axelor.apps.account.db.repo.AnalyticMoveLineRepository)2 InvoiceLineRepository (com.axelor.apps.account.db.repo.InvoiceLineRepository)2 InvoiceRepository (com.axelor.apps.account.db.repo.InvoiceRepository)2 FiscalPositionAccountService (com.axelor.apps.account.service.FiscalPositionAccountService)2